Skip to content

Instantly share code, notes, and snippets.

@heejune

heejune/democore.cpp

Created Feb 25, 2017
Embed
What would you like to do?
wrl and cppwinrt combination
winrt::Windows::Foundation::IAsyncOperation<int> GetAsyncOp()
{
using namespace winrt;
using namespace Windows::Foundation;
for (int i = 0; i != 5; ++i)
{
co_await 5000ms;
}
co_return 1;
}
STDMETHODIMP DemoCore::GetCppwinrtDataAsync(::ABI::Windows::Foundation::IAsyncOperation<int>** value)
{
auto asyncOp = GetAsyncOp();
*value = reinterpret_cast<::ABI::Windows::Foundation::IAsyncOperation<int>*>(winrt::detach(asyncOp));
return S_OK;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.