How to generate UUID string in MFC

CString GenerateUuidString()
{
    CString strKey;
    UUID uuid;
    if (UuidCreate(&uuid) == RPC_S_OK)
    {
        PUCHAR szUuid;
        if (UuidToString(&uuid, &szUuid) == RPC_S_OK)
        {
            strKey = szUuid;
            strKey.MakeUpper();
            RpcStringFree(&szUuid);
        }
    }
    return strKey;
}