Modern, native way of creating WinAPI GUI apps in C++

22,923

Solution 1

I recently used Qt4 and was very pleased with the API. I found it straightforward, well documented, and the code is extremely concise.

Qt does an extremely good job of emulating the target OS look and feel (as @In silico pointed out in the comments, Qt actually draws everything itself and does not use native components) Regardless, this can be coded by hand or visually through the GUI editor in their IDE, Qt Creator. If you go this route, I recommend creating your initial GUI project (.pro file) there, then importing it into Visual Studio via the Qt Visual Studio Add-In.

Slots and signals, Qt's event/messaging system, is also worth mentioning. Yes, it's critical to GUI programming, but could also be extremely useful in lower-level code.

I expect Qt would work well in your project, but as always, create a few simple tests to ensure the technologies will work together feasibly.

Solution 2

Here are a few hints:

  • Don't lock yourself into C++. C# and Java (for instance) can be easily interop'ed with C/C++. (Through PInvoke or C++/CLI for the former and JNI for the later). C++ may not be the ideal language to write a GUI quickly.

  • Your requirement for "native windows look" is arbitrary and you should think it over. Is that really what you need ?

  • Winforms. It's an older technology but is still widely used. You use the API from C++/CLI or C# (or any .NET) language.

  • WPF, a more recent API but that will be harder to deal with from C++, (better with C# or VB)

  • One of the many GUI toolkit available on the market that have a C or C++ API (QT, GTK, wxWidgets, the VCL, ... list here). Some have "native" looks, some don't. Some have designers some don't. Some are free, some aren't.

Solution 3

If you need simple user interface i recommend use WTL - is simple, lightweight, header-only library, very good wrapper over WinAPI. In Visual Studio you can use form designer for creating windows and use WTL classes for implement interaction with user. WTL have poor documentation but WTL is looking like MFC.

If you want rich possibilities i recommend use Qt. It's very powerful GUI framework with great community.

Solution 4

You can use the C++Builder XE2 (Part of the Rad Studio IDE), which includes the VCL (Visual Component Library), the VCL is a wrapper over the Windows controls (and also includes custom controls) which increase the development productivity.

Solution 5

The wxWidgets c++ class library comes with a screen builder.

Share:
22,923
B.Gen.Jack.O.Neill
Author by

B.Gen.Jack.O.Neill

Updated on October 07, 2020

Comments

  • B.Gen.Jack.O.Neill
    B.Gen.Jack.O.Neill over 3 years

    First, I know this is kind of common question, but I could not find the exact answer I am looking for.

    I have done many projects in Java using Swing. Starting by just coding the GUI, then later moving onto GUI designers. This proved to be a very quick and easy way to build GUI apps.

    But now, I need to move to C++. I am beginning a project which uses a lot of HW resources (DirectX, OpenCV, etc...) I know there are Java libraries for these technologies. However, C++ is definitely the right way to go, considering the internals of this project.

    I know C and C++ languages well from MCU programming. Also, I have read many articles on native WinAPI programming, Windows internals, etc. I think I have enough knowledge to start. I don´t want to worry much about GUI design, but it must look appropriate.

    I know there are few basic options: Pure WinAPI, MFC, WTL, Qt... I would be very glad if there were some kind of GUI designer tool, but from my research, there is not. There is the MFC wizard which helps to create a basic window, but it is not a designer. The closest thing I found was Qt. But from what I read, it is not using WinAPI for drawing, for in future look and feel of Qt written app can differ from native Windows look.

    So, to summarize, please, if you are experienced with creating native Windows C++ Apps with GUI, what would you recommend to me? Specifically, is there any tool or designer I missed?

    (I am using Visual Studio 2010 professional, since I have it free thanks to the DreamSpark project)