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 :)
精彩评论