Created
February 25, 2017 12:40
-
-
Save heejune/cbb30b81da86de57a850dcc967c5f63e to your computer and use it in GitHub Desktop.
wrl and cppwinrt combination
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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