UuidToString on WinRT

UuidToString on WinRT

本文关键字:WinRT on UuidToString      更新时间:2023-10-16

我有一个c++ WinRT (Windows Phone)项目,需要使用uuid。

我有这样的代码:

UUID vol_uuid;
CoCreateGuid(&vol_uuid);
RPC_WSTR    volbuf[256];
UuidToString(&vol_uuid, volbuf);

然而,Visual Studio在最后一行给了我一个UuidToString undefined错误。(CoCreateGuid似乎没问题)。我确实包括了<rpc.h>,但参考声明此功能仅用于桌面。

是否有其他库函数将UUID转换为字符串?

使用StringFromGUID2, http://msdn.microsoft.com/en-us/library/windows/apps/ms683893.aspx,这是Windows Store应用程序的Win32 api白名单。

这些api的完整列表,也可以在这里找到CoGreatGuid,在这里:http://msdn.microsoft.com/en-us/library/windows/apps/dn424765.aspx.