1

I have a little problem with the 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.

CharlesB
  • 86,532
  • 28
  • 194
  • 218
Monday
  • 13
  • 3

1 Answers1

1

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 :)

CharlesB
  • 86,532
  • 28
  • 194
  • 218