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

B.Gen.Jack.O.Neill picture B.Gen.Jack.O.Neill · Mar 16, 2012 · Viewed 20.8k times · Source

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)

Answer

Courtney Christensen picture Courtney Christensen · Mar 16, 2012

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.