You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Something that was great about Win32 API/controls was that we were able to create an application from scratch without any designer/XAML file. This enabled the possibility to create libraries as wrappers of the Win32 (MFC was an example of that).
So my question is that if it's possible (or there are plans) to create a .cpp file that creates a window and WinUI 3 controls from scratch using only code (creating COM objects, using C++/WinRT, etc.).
There is a way.
The attached project shows a little example of this, but it is a pain. There are plenty of non obvious things, like the application object being required to implement the IXamlMetadataProvider interface. While my sample does it, it is technically incomplete. It really should report the main window type. Hooking up the binding requires implementing the binding information too. But honestly, for this sample, I basically sought inspiration (read as copied wholesale) the code that the Xaml compiler produces.
There is a couple of extra things that I do which is basically doing the same thing as the Windows App SDK. The XamlCheckProcessRequirements function call and exporting of various functions in this case.
This is also unsupported. Although I feel as if that is obvious. XamlExp2.zip
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Something that was great about Win32 API/controls was that we were able to create an application from scratch without any designer/XAML file. This enabled the possibility to create libraries as wrappers of the Win32 (MFC was an example of that).
So my question is that if it's possible (or there are plans) to create a .cpp file that creates a window and WinUI 3 controls from scratch using only code (creating COM objects, using C++/WinRT, etc.).
Beta Was this translation helpful? Give feedback.
All reactions