char *pszObject //Your parameter
HRESULT hr;
WCHAR szObject[128];
WCHAR wszMsg[128] = {L"Your Message Here...\n"};
IMoniker *pmkObject = NULL;
IUnknown *pIUnk = NULL;
IPersistFile *pIPersistFile = NULL;
ICustomInterface *pICustomInterface = NULL; // Create a wide-character version of the object's file name.
wsprintf(wszObject, L"%hs", pszObject);
// Get a file moniker for the object (a *.smp file).
hr = CreateFileMoniker(wszObject, &pmkObject);
if(FAILED(hr))
{
printf("Client: CreateFileMoniker for Object failed");
return;
}COM要求使用宽字符.按上面例子改一下,还有问题吗?
HRESULT hr;
WCHAR szObject[128];
WCHAR wszMsg[128] = {L"Your Message Here...\n"};
IMoniker *pmkObject = NULL;
IUnknown *pIUnk = NULL;
IPersistFile *pIPersistFile = NULL;
ICustomInterface *pICustomInterface = NULL; // Create a wide-character version of the object's file name.
wsprintf(wszObject, L"%hs", pszObject);
// Get a file moniker for the object (a *.smp file).
hr = CreateFileMoniker(wszObject, &pmkObject);
if(FAILED(hr))
{
printf("Client: CreateFileMoniker for Object failed");
return;
}COM要求使用宽字符.按上面例子改一下,还有问题吗?
你试过没有?
wsprintf(wszObject, L"%hs", pszObject);
在我这里不行 can not convert wchar * to char *!!
也不知道目录中带空格怎么处理,比如My Documents