Programming to WinRT with Standard C++ using C++/WinRT
Вставка
- Опубліковано 20 сер 2024
- This month, Richard Thomson will give us an introduction to the WinRT APIs and how you can access them from standard C++, without resorting to non-standard language extensions and compilers. The WinRT APIs are the heart of writing Universal Windows Platform (UWP) applications that target Windows 10 desktop PCs and other devices such as Xbox and the Surface Hub.
WinRT is designed to be language agnostic and follows in the footsteps of COM (the Component Object Model) that has been on Windows platforms since 1993. To access the WinRT API you use a language projection appropriate to your programming language. C++/WinRT is a language projection that uses only standard C++ mechanisms.
We'll go over a little bit of the history of WinRT and how it relates to previous APIs available to C++ programmers on the Windows platform. Next, we'll discuss the mechanisms used by the C++/WinRT language projection implementation, which is a pure header-only library. Finally, we'll take a look at some examples of C++/WinRT applications and the support Visual Studio provides for writing such applications.
Thanks a lot. This video was the highlight of my week and helped me finish my small Win32 project wich does WinRT calls
wonderful talk!
wy microsoft bothered to have init_apartment explicitly
i used to think the win32 implementation was awful, but compared to the dumpster fire of winrt/winui3, win32 wasn't so bad in retrospect. just creating a basic project using the newer api drops a vomit of files in the project folder. at this point, i'm beginning to think 3rd party ui frameworks are the way to go. maybe qt or gtk. i don't know if they're more sensible, at least they'll be cross platform.
There's a really good video from CppCon, I think, where the developers of a mobile app across Android and iOS talk about moving almost everything into C++ in order to share code. They even have the UI view processing in C++ with only the thinnest of UI layers in Objective C and Java on the respective platforms. IIRC, it was the DropBox developers.
Technically you can still just start with a single C++ source file and start using Windows Runtime APIs, no need to use the project template. But the project template sets up precompiled headers and many other things, as well as enabling XAML markup support if you need that.
Please for the love of everything holy on this earth do a tutorial on current implementation of x:Bind and PropertyChanged events. C++/WinRT WinUI3... if you please.
GUI programming is always involved, I guess I could have a whole channel devoted to that alone, LOL. However, I'll take a look and see if I can do a quick video on it.
@@UtahCppProgrammers Thank you ahead of time if you do. I have been working on wrapping my brain around the IDL files. I reverted to c# for now. In the end the obvious way would be to just do the UI in c# and the heavy work in c++
This video from the DropBox team on their cross-platform (really cross-language) experience might be useful in designing your architecture with a UI in C# and heavy lifting in C++.
ua-cam.com/video/5AZMEm3rZ2Y/v-deo.html
14:55 This is not very true as .NET has so much more APIs that WinRT doesn't. The system WinRT API set only is very small compared to .NET's API set.
Can you provide an example? Sometimes it's difficult to research things like this because Microsoft moves their documentation around, renames platforms with different marketing monikers, etc.
Just 3 years later it kind of seems WinRT is dead. The documentation lacks good examples, Xaml-based apps for unpackaged Win32 C++ apps is not a topic anymore. VS2022 does not include WinRT project templates anymore. An so on. That's MS.