Best way to write windows user interfaces for c++ programs

Started by
4 comments, last by Green_Baron 4 years, 7 months ago

It's been a while since I've had to develop a windows interface for an app, and now I must do exactly that but I'd like to go about it in the best way possible. Years ago when I had to do it, I just used straight forward WinAPI with GDI to manually create and position buttons, frames, etc. directly in C++ code. Now with the advent of the unified windows architecture I'm not sure that's the best possible way to do it anymore (and frankly I'd rather it not be since it was pretty tedious). I'll start off with the choices I'm considering at the moment, please feel free to add anything to that list that I'm missing: 

  • Using Visual Basic .NET - this is probably the easiest choice as I'm familiar with the language and the ability to graphically design the UI is enticing
  • Using XAML - I'm not so familiar with this, but I did write a small interface for a Windows Phone app (when the platform was still running) and I remember there also being a graphical design tool although I'm not sure it's available on windows.

Another aspect of that matter is that as the title suggests, I'd like to eventually interface with c++, I know it's not incredibly difficult to do with any system through DLLs but I'd thought I'd mention that in case there is a way that I can somehow avoid that. An ideal situation would be if I had a graphical editor that I could design the interface in and the write all the code that interacts with it in C++, but it might be wishful thinking and so I'll take what I can get. 

Thanks.

You didn't come into this world. You came out of it, like a wave from the ocean. You are not a stranger here. -Alan Watts

Advertisement

For the case of being something oldschool, using C#-Winforms is a viable option because you have the graphical editor in Visual Studio and also can interact either via command line (if your app cares of command line parameters) like the UI arround SVn or Git or you can drive the p/invoke route and "import" the C++ into your interface application using DLLImport Attributes and c-style export functions

So it turns out the option of using XAML is actually viable. I think I should be able to use the Visual Studio's XAML UI designer and still write the code in a version of C++ called C++/CX. I'm not exactly sure if it's entirely the same but it appears that it's just C++ with extensions that enable the calling of Windows Runtime. For now I'll try that although I think the drawback is that I can only create the new Windows control elements that the new UI uses. I'm not too fond of them to be honest, I'd rather have the old interface look but I guess it beats writing the whole UI by hand. Thanks.

 

You didn't come into this world. You came out of it, like a wave from the ocean. You are not a stranger here. -Alan Watts

You can write your own little UI framework using modern OpenGL like in games. You can make it cross-platform. But it is individually. I write my own UI engine in OpenGL and I use WinForms, WPF but in C#, and I study HTML/CSS for web applications in TypeScript. I think the best way for C++ is Qt because another UI frameworks is not such popular in the C++ world.

On 8/28/2019 at 2:28 AM, VanillaSnake21 said:

 An ideal situation would be if I had a graphical editor that I could design the interface in and the write all the code that interacts with it in C++, but it might be wishful thinking and so I'll take what I can get.

I have no idea about windows specific api's and the capabilities of .NET that are probably superb, but how about gtk+ and its builder glade ? Just one of my probably superfluous random thoughts ...

This topic is closed to new replies.

Advertisement