Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/162.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 当Windows 10应用商店应用程序的试用许可证到期时,不会引发OfflineLicenseShanged事件_C++_Windows Runtime_Uwp_Windows 10_Wrl - Fatal编程技术网

C++ 当Windows 10应用商店应用程序的试用许可证到期时,不会引发OfflineLicenseShanged事件

C++ 当Windows 10应用商店应用程序的试用许可证到期时,不会引发OfflineLicenseShanged事件,c++,windows-runtime,uwp,windows-10,wrl,C++,Windows Runtime,Uwp,Windows 10,Wrl,我正在为我的Win32应用程序尝试以下代码,该应用程序已转换为Windows 10应用商店的UWP。该应用程序以试用许可证在商店中发布7天 下面代码的目标是在应用程序的试用期到期时收到通知: #include <Windows.Services.Store.h> #include <wrl.h> #include <wrl/event.h> //'hMainWnd' = HWND handle to the app's main window //ComP

我正在为我的Win32应用程序尝试以下代码,该应用程序已转换为Windows 10应用商店的UWP。该应用程序以试用许可证在商店中发布7天

下面代码的目标是在应用程序的试用期到期时收到通知:

#include <Windows.Services.Store.h>
#include <wrl.h>
#include <wrl/event.h>

//'hMainWnd' = HWND handle to the app's main window

//ComPtr<IStoreContextStatics> storeContextStatics;
//...

ComPtr<IStoreContext> storeContext;
hr = storeContextStatics->GetDefault(&storeContext);
if (SUCCEEDED(hr))
{
    EventRegistrationToken tokenLicChanged;
    hr = storeContext->add_OfflineLicensesChanged(Callback<__FITypedEventHandler_2_Windows__CServices__CStore__CStoreContext_IInspectable_t>(
        [hMainWnd](IStoreContext* storeCntx, IInspectable* pDispArgs)->HRESULT
    {
        //Must be called when store license changes

        ::MessageBox(hMainWnd, 
            L"HELL YEAH -- LICENSE CHANGE NOTIFICATION!!!", 
            L"*****LIC CHANGE Result*****",
            MB_ICONINFORMATION);

        return S_OK;
    }).Get(), &tokenLicChanged);

    if (SUCCEEDED(hr))
    {
        //Put this thread into a waiting state...

    }
    else
    {
        __assert_and_fail();
    }
}
else
{
    __assert_and_fail();
}
#包括
#包括
#包括
//'hMainWnd'=应用程序主窗口的HWND句柄
//ComPtr storeContextStatics;
//...
ComPtr-storeContext;
hr=storeContextStatics->GetDefault(&storeContext);
如果(成功(hr))
{
EventRegistrationToken已更改;
hr=storeContext->add_offlinelicensechanged(回调)(
[hMainWnd](IStoreContext*storeCntx,IInspectable*pDispArgs)->HRESULT
{
//存储许可证更改时必须调用
::MessageBox(hMainWnd,
L“是的,许可证变更通知!!!”,
L“******LIC变更结果******”,
MB_(信息);
返回S_OK;
}).Get(),&tokenLicChanged);
如果(成功(hr))
{
//将此线程置于等待状态。。。
}
其他的
{
__断言和失败();
}
}
其他的
{
__断言和失败();
}
我让应用程序运行,并等待许可证到期,但从未提出


知道我做错了什么吗?

我正在检查issue@FranklinChen-MSFT:感谢你的帮助!我正在检查这个issue@FranklinChen-MSFT:感谢你的帮助!