开发者

COM : retrieve good CLSID

I have a little problem with th开发者_Python百科e CLSID.

I have a (hooked) function which has in param a REFCLSID. So I want to print this param.

I did:

LPOLESTR pOleStr;
StringFromCLSID(rclsid,&pOleStr); //rclsid is a REFCLSID type.
ofstream myfile;
myfile.open("C:\\output.txt",ios::app);
myfile << pOleStr << std::endl;
myfile.close();

But in "output.txt", I just have a 8 character string, but I should have a string like : 111111-2222-3333-4444-000000000000.

So if anyone has an idea...

Thanks.


Just a guess, I think that LPOLESTR is widechar, you'd have to convert it to ASCII using

CHAR  szCLSID[60];
WideCharToMultiByte(CP_ACP, 0, pOleStr, -1, szCLSID, 60, NULL, NULL);

Also don't forget to CoTaskMemFree(pOleStr) afterwards :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜