#include <Rpc.h>
#pragma comment(lib, "Rpcrt4.lib")
UUID uuid;
::ZeroMemory(&uuid, sizeof(UUID));
// Create uuid or load from a string by UuidFromString() function
::UuidCreate(&uuid);
// If you want to convert uuid to string, use UuidToString() function
WCHAR* wszUuid = NULL;
::UuidToStringW(&uuid, &wszUuid);
if(wszUuid != NULL)
{
::RpcStringFree(&wszUuid);
wszUuid = NULL;
}
Reference in MSDN:
::UuidToStringW(&uuid, &wszUuid);
if(wszUuid != NULL)
{
::RpcStringFree(&wszUuid);
wszUuid = NULL;
}
Reference in MSDN: