I'll try to summarize my issue as concisely as I can:
- I have a legacy C++ project that uses WinAPI to create and manage UI elements. I want to replace this with a more modern framework that supports OOP and has some kind of visual designer. I intend to achieve this by gradually replacing the old WinAPI-based code with the new framework (e.g I could introduce a new popup window that uses the new framework, while the rest of the UI would still use the old window procedures and whatnot)
- My initial plan was to use Qt, since it allows me to conveniently wrap UI code in objects, which I can easily instantiate and manage. It also has a Designer that lets me create custom UI elements (including automatic layout management), a Visual Studio extension, and in general, past experience has shown me that Qt would suit my purposes quite well. However, users here have warned me that it does not cooperate well with WinAPI, and I would basically have to rebuild the app from scratch.
- It was suggested that I use WinUI instead, i.e XAML coupled with C++/WinRT, as these supposedly offer the same flexibility as what I described above. I managed to successfully replicate the results of the "host UWP control in a Win32 app" guide, but there seems to be little useful material beyond that.
- The Microsoft documentation is rather difficult to navigate in order to get a clear answer. At the moment, the guide above is leading me to believe that I'd still be stuck with using WinAPI, as there doesn't seem to be an obvious way to wrap UI code in objects, preferably those that I can derive from existing base classes (e.g some kind of basic Window object)
I have the following environment to work with:
- Latest C++ feature level supported by MSVC
- Visual Studio 2019
- Windows 10 (i.e I don't mind if I'm no longer compatible with Windows operating systems)
What I need:
An explicit answer on whether it is possible to work with XAML and C++/WinRT in a similar fashion to how one designs UI code in Qt with C++. Exact parity is not necessary, I just want to eliminate the hassle of managing UI using WinAPI, where I practically have to do everything "by hand"
If the above is true, then where can I find guides for the various steps of the workflow? How do I make a "window object", how can I design a window with layout management, how do I handle UI events, etc.?
Are the above equally possible if it needs to be done in the context of a legacy WinAPI application that I am trying to upgrade?