CoCreateGuid
-
I am calling CoCreateGuid to get the guid but now I need to take the guid and copy it into a string. I have tried several different ways but nothing is working. So far my code looks like GUID guidID; if( S_OK == CoCreateGuid(&guidID) ) { } How can I take guidID and copy it into a char string?
-
I am calling CoCreateGuid to get the guid but now I need to take the guid and copy it into a string. I have tried several different ways but nothing is working. So far my code looks like GUID guidID; if( S_OK == CoCreateGuid(&guidID) ) { } How can I take guidID and copy it into a char string?
I use this with MFC:
// Format is XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
strGUID.Format(_T("%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X"),
guid.Data1,
guid.Data2,
guid.Data3,
guid.Data4[0],
guid.Data4[1],
guid.Data4[2],
guid.Data4[3],
guid.Data4[4],
guid.Data4[5],
guid.Data4[6],
guid.Data4[7]);In your case, replace strGUID with a char array, and replace Format with sprintf. In Italy for thirty years under the Borgias they had warfare, terror, murder, bloodshed - but they produced Michelangelo, Leonardo da Vinci and the Renaissance. In Switzerland they had brotherly love, five hundred years of democracy and what did that produce - the cuckoo clock! -- Harry Lime
-
I am calling CoCreateGuid to get the guid but now I need to take the guid and copy it into a string. I have tried several different ways but nothing is working. So far my code looks like GUID guidID; if( S_OK == CoCreateGuid(&guidID) ) { } How can I take guidID and copy it into a char string?
Lookup the following: StringFromGUID2 StringFromIID StringFromCLSID