My new course about the internals of the Windows Runtime is now available from Pluralsight!
Discover the compilers, tools, mechanics, and abstractions that make up the Windows Runtime’s component architecture.
This course will help you understand how the class-based component abstraction presented by Windows Runtime language projections is actually implemented in terms of traditional COM interfaces. You will learn all about the tools and compilers that are necessary to build rich components entirely with Standard C++ in the most efficient manner. You will discover how abstractions like constructors and static methods are implemented with activation factories. You will learn how delegates and events are actually implemented with COM interfaces and lock-free algorithms. And you will discover the weird and wonderful way that the Windows Runtime uses C++ templates to simulate CLR generics using parameterized interfaces.
This is my first advanced level course for Pluralsight and not for the faint-hearted. Enjoy!
kenny
great course,
but u didn’t covered iasynoperation and its variant
auto main()
{
Check(RoInitialize(RO_INIT_MULTITHREADED));
auto userStatics = ActivateInstance(L”Windows.System.UserProfile.UserInformation”);
ComPtr<IAsyncOperation> operation;
Check(MakeAndInitialize(&operation));
// how to execute the below function ???????
Check(userStatics->GetDisplayNameAsync(operation.GetAddressOf()));
return EXIT_SUCCESS;
}
do i have to use threadpool.
how to execute the below statement
userStatics->GetDisplayNameAsync( what to pass )
The component provides the implementation of IAsyncOperation. You simply need to grab the reference returned by GetDisplayNameAsync and wait for it to complete. Remember that IAsyncOperation is a parameterized interface so you need to use something like this:
ComPtr<ABI::Windows::Foundation::IAsyncOperation<HSTRING>> operation;