Skip to content

Instantly share code, notes, and snippets.

Created February 25, 2017 12:40
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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