Looking for guidance on writing desktop apps

Hi People,
I want to write some desktop apps. I have some good ideas. However, I have become very aggravated with current book offerings. I have 2 books on C++. They cover everything you can need. It is the most powerful language in computing today. So I would like to write desktop apps using C++.
Then there is C#. I would not have a problem learning this language as long as I am not writing console apps. I have also been learning Java. One book I have has been using BlueJ. Until today that has been going pretty good. I have run into a roadblock with this book. The other Java book is an OReilly book. It uses Eclipse and I am having problems with Eclipse usage.
I am very aggravated right now. I am looking for useful help. I am buying books from Amazon and returning them as they are only about console apps, NOT WHAT I WANT.
I also do not have a problem with learning C# and .net.
I don't want to get into Winforms, UWP or any soon to be deprecated software.
Thanks for your help.
Last edited on
use C# to make windows desktop programs. The microsoft windowing library for c++ is an unholy mess of their not-exactly-c++ specialty syntax and 'managed' code.
the C# is a lot like c++, which is its grandparent, and it makes interfacing to the windowing stuff much easier.

more portable, but annoying to use due to cruder tools, is QT which isn't going anywhere.

As for books, I can't help you. Everything you need is online, and books go out of date so fast for so much money, I have put them aside.

what you are seeing is due to the nature of c++. Languages that span many OS and platforms don't typically have built in UI like C# which was made only for windows and ported anywhere else, have. The idea of a GUI barely existed when C++ came out, if at all. Point being that a GUI for windows and one for mac are very different libraries and behave very differently towards the user, and c++ doesn't have the capacity (people working on the language) to support all that, and graphics, and sound, and all the other things that are different for each OS and across generations of OS all the way back to 1980ish. So it leaves that to libraries, and the core language only does console programming. Visual studio has built in tools for it, but again, their c++ version of it is just downright weird.

typically you want to keep the real code and the UI code apart anyway, so you can do the real code in c++ and just put the UI onto it in c# with minimal frustration. C++ will perform a little better; how much depends on what you did and how you did it and whether it matters (rarely does).

QT is pretty awesome, in spite of not having the microsoft money behind it; take a look. When I said it was cruder, NOTHING else really makes a complete package the way visual studio does, and that has been true since the 90s.
Last edited on
I would recommend WPF and C#. It's mature and powerful.
https://www.wpf-tutorial.com
As Jonnin says above, the C++ language standard only supports console programs - not gui ones. Most books on standard C++ therefore concentrate mainly on the console. To have gui with C++ requires using 3rd party libraries (including those from Microsoft - MFC (out of date), WIN32 (very old fashioned!) and c++/winrt (produces uwp app) ). There are several available. See:
https://en.cppreference.com/w/cpp/links/libs

FLTK is used in Stroustrup's book Programming: Principles and Practice Using C++ 2nd Edition
https://www.amazon.co.uk/Programming-Principles-Practice-Using-C/dp/0321992784/

Once you have decided upon which 3rd party library(s) to use with C++, then there are specific books/web resources available.
In the past there was Visual C++, but those days are gone. I am leaning towards C#. I have 2 books on C++ and they are extensive. As has been mentioned the books I have on C++ is that it is a console app. I was hoping to find some type of GUI process to use C++ to make desktop apps. It looks like I am going down the C# road.
Thanks for the comments guys.
Mark
You can do it, if that is what you really want. The weird microsoft managed extensions / .net or whatever they call it today works fine. It just has unusual syntax (I believe they have overloaded the xor operator to do something radically different for pointers that are not c++ smart pointers but their own mess) and is a frustrating experience at times. Ive not used it much, just a couple of demo level programs really. My main work is still in MFC, an older program that is still quite relevant and maintained.

Or any other library you like.
Its not a lack of can't do, or shoudln't do, so much as 'they didn't make it easy'.
C# made it easy. There is a reason for that. C# exists in a large part because M$ lost a lawsuit. Its the fallout of their attempt to microsoftify java and getting sued. But the result was what they always wanted anyway: their own language doing things their way. That meshes cleaner to their libraries and strange designs. To an extent, they also try to microsoftify C and C++; even the older MFC did this with renaming of standard types, their not quite a pointer handle concept, the garbage collection (.net) and such. It didn't become a legal problem because they kept it apart as just a library.
Last edited on
Yep - C++/cli which uses .net (the same as c# and vb.net). In C++/cli (cli - Common Language Infrastructure) ^ means 'boxing' and is used with a .net managed object as opposed to a 'normal' unmanaged C++ object.

C++/cli was designed by Herb Sutter (the convener of the C++ standards committee).

https://learn.microsoft.com/en-us/cpp/dotnet/dotnet-programming-with-cpp-cli-visual-cpp?view=msvc-170
Last edited on
I've used wxWidgets in the past for a few hobby applications.
https://www.wxwidgets.org/

It's not horrible if you just want a practical GUI that has a native look-and-feel, but isn't nearly as powerful as things like WPF.
For something different, here is a video by Cherno, about the ImGui.

I haven't tried it, but may be worth a look :+)

https://www.youtube.com/watch?v=vWXrFetSH8w
you can give a look at flutter/dart development.
If you have solid knowledge of standard C++ then MS docs will be good enough for you to quickly bring up some windows.

The best approach is to start working one some personal project, a rudimentary UI library with the only purpose to create a window.

Then you go step by step each day and start implementing stuff, menus, buttons etc..

UI programming in C++ is all about using Windows functions.

You can as well use and learn some already made UI library to avoid windows function, but by doing so you won't boost your skills at all and good luck with limitations of a UI library, if you're serious you'll regret using a library sooner or later.

---

Otherwise if C++ is not your strong language then books are the best choice, sadly there aren't many great books about UI.
Petzholds's books is a good start, everybody started with that one.
> I also do not have a problem with learning C# and .net.

>> I would recommend WPF and C#. It's mature and powerful.

+1

Use PInvoke (or C++ Interop aka "It just Works") to enable interoperability between C# and C++ code.
https://mark-borg.github.io/blog/2017/interop/
Registered users can post here. Sign in or register to post.