(cpp)cx中将string转换成GUID

1
2
3
4
5
6
7
8
9
10
11
12
13
#include <windows.h>
using namespace Windows::ApplicationModel::Store;
using namespace Windows::Foundation;
using namespace Windows::Foundation::Collections;
Platform::String^ transactionId = "{xxxxx}"; //从微软的内购中获取的订单号字符串
GUID guid;
HRESULT hr = IIDFromString(transactionId->Data(), &guid);
if (SUCCEEDED(hr)) {
Platform::Guid guid_transactionId(guid);
auto fuillAsync = CurrentApp::ReportConsumableFulfillmentAsync(productId, guid_transactionId); //完成订单
}