Reputation: 449
I have some long strings. Each strings contain information of a windows computer (computer name, MAC address etc). I want to generate 8 character long UIDs from those strings. How I can generate that ? Is there any C++ library or method to do that.
Upvotes: 0
Views: 288
Reputation: 50667
You are looking for GUIDFromString
to converts a string
to a GUID
.
BOOL GUIDFromString(
_In_ LPCTSTR psz,
_Out_ LPGUID pguid
);
Alternatively, you can try CLSIDFromString
. A CLSID
is actually defined as:
typedef GUID CLSID;
therefore you can use CLSIDFromString
to generate a GUID. Here's some sample code:
LPWSTR guidstr;
GUID guid;
...
HRESULT hr = CLSIDFromString(guidstr, (LPCLSID)&guid);
if (hr != S_OK) {
// bad GUID string...
...
}
Upvotes: 1