How to write modern Windows software in C++?
Asked Answered
H

6

14

I am very interested in how modern Windows software is written in C++ nowadays. I asked my friend who had worked on Windows software and he told that last things he worked with were MFC and then WTL. He said that MFC is no longer anything modern but WTL is still used but he didn't know much more. He also said that WTL wasn't that modern and before that he programmed in pure Windows API.

How does one write software for Windows Vista or Windows 7? Do you still use WTL? What about MFC and pure Windows API? Or are there other libraries now?

I don't know much about it, but have C# or other .NET languages replaced C++ in writing modern Windows software?

Heaume answered 25/6, 2010 at 20:52 Comment(0)
O
13

From what I've seen over the past several years:

  • WTL is on a lifeline. Abandoned by Microsoft, picked up by fans and there were several very dedicated followers. Very clean, but the learning curve is steep and the fan base dwindling. The Yahoo group is not very active. I can't recommend it.

  • MFC got another lease on life when MSFT released the feature pack. Rather extensive and a bit un-MFC-ish, it has strong support for skinning, docking layouts and ribbons. I thought it was going to be wildly popular but never did see a lot of devs jumping on it. MSDN forum questions have been sparse. If you have an existing MFC codebase then definitely take a look. Another MFC refresh for VS2010 with Win7 features added, it does stay the company's base UI solution.

  • wxWidgets is still around. No personal experience, but Lord, the few practitioners I've heard from are bitching up a storm. Real bitter stuff too.

  • Qt has been around for quite a while but picked up stream considerably, especially in the last year. Whomever uses it really likes it. It is moving beyond the confines of a UI class library as well, their users are looking actively for solutions to common programming tasks that start with the letter Q. That's a powerful vote of confidence.

But if you are on a Microsoft stack, none of these class libraries is where the real UI development is at. WPF is the elephant in the room, it's capabilities are a hundred miles beyond what's listed above. Its ability to break device and paradigm boundaries are powerful, writing code that runs on a desktop as well as a web browser as well as a phone is hard to beat. But C++ is not part of that.

Oglethorpe answered 25/6, 2010 at 21:22 Comment(5)
I am going to take a look at WPF. Thanks!Heaume
I use QT and loathe it. Apparently I'm in the minority. It's the most inefficient GUI framework I've ever seen, especially when it comes to using CSS style sheets for skinning. Creating a dozen CSS-skinned button widgets on an i7 takes over 1000 ms. Its support on OS X is also pretty shoddy. The MOC adds very noticeably to compile times, and it has a terrible memory management model. Regardless, it's among the best we have when it comes to cross-platform frameworks when it comes to providing GUIs, threading, networking, etc. all in one.Waring
I use Qt all the time and it's truly where modern C++ development is at.Phebephedra
It's all in Qt, check out github.com/relipse/JsRoboKey for a slew of examplesPrickle
Agree, wxWidgets is a worthless toolkit for professional development. MFC with Feature Pack was never used because it was so buggy, undocumented and non Windows like.Pentapody
B
12

WTL, Qt, wxWidgets are used pretty common.

  • They all allow rapid GUI development and are pretty versatile (third option, to my mind, takes more time to get used to). Second and third options are really cool because they're cross-platform.

  • Writing windows in pure WinAPI is extremely oldschool but sometimes could be entertaining.

  • C# approach to building windows is even more rapid compared to previous options, but is a bit less flexible.

Blayne answered 25/6, 2010 at 20:58 Comment(0)
V
9

Have a look at Qt -- you may like it. Unless of course you prefer a something non-portable version. But even if you don't plan to build on OS X, Linux, phones, ... the Qt framework is well written, well documented and just works. The SDK now includes a nice IDE (Qt Creator) too.

Veneering answered 25/6, 2010 at 20:52 Comment(0)
P
9

WTL everytime if your main platform is Windows. Google Chrome uses it, Spotify use it. Its the most productive, flexible, isn't a resource hog. By flexible I mean you can use it with pure Win32 API code / other C++ code without too much difficulty.

For more WTL information: collection of WTL links

Prominent answered 2/9, 2010 at 22:38 Comment(0)
P
4

After evaluating i came to the situation where pure Win32 or WTL is the only way to write modern style win apps which are not WRT based.

The new look is the main point. MFC looks terrible on Win8 and Win10 especially with all this Feature Pack eye candy. Pure MFC is good but fat and the view-model part is just outrages terrible and i just like WTL more. But it's undocumented and this is so bad and scary.

WxWidgets is an ugly toy.

QT is not an alternative anymore too. They focus too much on mobile and appframework. And if you go MacOSX you can't use QT at all (yes it will run but it will make you vomit about the UX).

WinRT is so restrictive and lacking features that you can't use it. And you can be sure that it will fail because nobody is using the WinStore or Windows on Tablets/Phones. So why bother.

WPF is ok if you think you user appreciates slow and fat apps. It looks nicer but all the eye candy is now not part of the UI design guidelines anymore and the feature set of the widgets is less then Win32 native widgets. Unbelievable but true. And i locks you into using unportable C# which is deprecated in my opinion because now performance matters again (because performance is energy, is life time).

Even Herb Sutter and other high ranking MS employees tell you that C++ is the future. And the next killer app is build on C++14 and Microsoft knows it.

UPDATE[2023]:

I stand to the words i have written before. And Microsoft has finally agreed, so they developed WinUI3 and added it to the Windows App SDK. WinUI3 is a C++ widget set based on WinUI but without the sandbox restrictions of WinRT. They just ported the Windows File Explorer as first real world large scale application.

And while still terrible to use for programmers (terrible tooling, especially no Visual GUI Designer) and lots of missing features. Can't even get an event when the tree selection changes, they made clear that this is the only way to go on windows ... sooner or later.

The sad state of native developing still continues.

Pentapody answered 13/12, 2015 at 7:34 Comment(1)
WTL/Windows API can be hard work but less encumbered than the other alternatives for desktop. WTL is documented and there is a good community around it, WTL is still updated. You have to accept to a certain extent you are going to have to learn the Windows API if you want to get proficient with WTL but WTL does much of the hard work for you.Prominent
A
2

In .NET (C#, VB.NET, ...), the cutting edge of GUI programming is WPF at the moment (replacing WinForms). Compiled code in .NET is actually CIL which is compiled into native code at runtime by the JIT. This has the advantage that you do not have to care about 64 or 32 bit target systems.

In C++, Qt seems a good solution as it is cleanly designed and provides a big bunch of services. What I dislike in Qt is its compile round trip, it is so slow, there is a moc compiler, the compiler, then link, it takes ages compared to C#/.NET to get the executable. On the other side you may encounter it even in embedded systems, what makes it interesting in such cases.

I would advice you to have at least a look C#/.NET and experiment with it before deciding.

Alodium answered 25/6, 2010 at 21:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.