Babiker
Babiker

Reputation: 18798

Advice for C++ GUI programming

I have been writing C++ Console/CMD-line applications for about a year now and would like to get into windows GUI apps. What advice/tips can you give me? Ex: good readings, tutorials, approach tactics, etc...

Upvotes: 16

Views: 14362

Answers (12)

beef2k
beef2k

Reputation: 2247

I highly recommend the use of the Qt Libraries for several reasons:

  1. The Framework is freely available for Windows, Linux, MacOS X, and a couple of mobile systems. Since version 4.5 the license is LGPL, which basically means that you can use Qt even in commercial applications.
  2. The design of Qt is out-standing, e.g. they use modern design patterns and a very consistent interface design (I don't know many other libraries that use object-oriented ideas in such perfection). Using Qt is the same as using Boost: it will improve your own programming skills, because they use such beautiful concepts!
  3. They are bloody fast, for instance in rendering (due to the different back-end for OpenGL, DirectX, etc.). Just have a look on this video and you see what can easily be done with Qt but is hard to achieve with native Windows, Mac, or Linux programming.
  4. They have a really great documentation, with tons of tutorials and a very good reference. You can start learning Qt easily with the given docs! The documentation is also available online, so have a look and see by yourself.
  5. As mentioned before, Qt is cross-platform; you have one source-base that works on all the important operating systems. Why will you limit yourself to Windows, when you can also have Mac and Linux "for free"?
  6. Qt is so much more than "just" the user interface; they also offer network and database functionality, OpenGL bindings, a full-working web-browser control (based on WebKit), a multimedia playback library, and much much much more.

Upvotes: 36

PowerApp101
PowerApp101

Reputation: 1826

I would put documentation at the top of my list of requirements for a GUI system. Qt has great docs and there's a huge community behind it. Also there are several books about it. Good docs are extremely important if you are working alone with no other team members to rely on. Alternatives are wxWidgets, MFC, WTL, FLTK and many more. They all have pros and cons. Eg FLTK is small and only provides GUI whereas Qt and wxWidgets also include networking, database access etc. Qt seems to have the most momentum at the moment after the Nokia buyout eg the release of Qt Creator which enables you to develop apps outside of Visual Studio.

Upvotes: 1

serge
serge

Reputation: 1022

We are in 2020 but the question is still pertinent. I agree with Qt users, it's a great framework.

However, there is also C++Builder that offers you design GUI visually at design-time. C++Builder application can be built on both VCL (Windows only) and FireMonkey (cross-platorm) frameworks. Clang compiler can produce both 32 and 64-bits native executables. Community edition of C++Builder is free. Delphi integration is seamless: C++Builder project can include Delphi files directly and use any existing Delphi component packages and libraries.

Upvotes: 0

johnny
johnny

Reputation: 14092

Most windowing libraries and technologies use similar idioms. Pick one and learn it.

The Windows Template Library is a very nice veneer for Microsoft Windows while sticking with C++.

For cross platform C++ windowing toolkits (they work on Microsoft Windows as well as other platforms) you can try QT or wxWidgets.

Upvotes: 4

Alireza Soori
Alireza Soori

Reputation: 645

Put aside WPF or VC++ or Qt, You can also try out several libraries such as :

  • OpenFrameworks
  • Processing
  • ...
  • there's an active project for developing Gui with Openframeworks here:
    http://www.syedrezaali.com/blog/?p=2172

    Upvotes: 1

    Mr. Shahid
    Mr. Shahid

    Reputation: 11

    The first question is that do you want to develop Free, Open Source, for personal use or Commercial applications in C++?

    1. If you want to develop for personal use! Then you can go with some good C++ Toolkit, Framework or API.
    2. If you want to develop an GUI application that will be open source or free. Then you can go with C++ Toolkits, Frameworks or API's that have the GPL or any open source license that fits your needs.
    3. Even you can develop Commercial applications with open source toolkits, frameworks or API's that have LGPL license.

    The second question is that do you want to develop for the Windows, Mac, Unix or Linux? or these all, even for the mobile platform?

    1. If you have a Windows user, as I am, and want to develop only for the Windows, I mean not for the cross platform, you can go with Win32 API, although, learning Win32 API is harder but it gives you the complete control over the machine. Believe me that no other tool would you provide the complete control over the machine. If you dislike Win32 API, for any reason, you can go with MFC, which is another technology from Microsoft, but is not free, old and has less attention now a days. If you decide to develop with .NET platform, you have C++/CLI, an extension to C++ language for developing .NET applications. .NET gives you the type safety, OOP and a built in garbage collector, provides you the all API's related to Windows and x86 or x64 machine in one package. .NET has its own world! Microsoft has decided to port .NET to other operating systems too, Mono project is an example... You can develop nearly all kinds of applications using .NET.

    2. If you want to develop C++ GUI applications for the cross platform, then Qt, WxWidgets and U++ are available for your help. You can write once and deploy anywhere with these libraries. Many open source IDE's and compliers are also available to develop C++ applications with ease. Note that if you do not want to develop for the cross platform, any cross platform library would be overhead and unavoidable increase in size of the executables.

    Is your C++ knowledge is good enough to program software systems?

    In fact, if your knowledge of C++ is not enough deep and you do not understand programming methods like OOP, Encupsolation, Classes, Interfaces, Types, Programming Patterns and so on, you can not use any toolkit with full potencial. Do not forget that every Toolkit, Framework or API is implemented in some programming language. If you do understand the language very well, you can use the toolkit very well. I think, you would understand my point.

    Upvotes: 1

    bashmohandes
    bashmohandes

    Reputation: 2376

    It has been so long since I worked with C++ on Windows GUI, my word is always avoid C++ in Windows GUI unless you have a very good reason, I mean a good darn reason, if you need some performance C# is more than enough for 90% of the cases, and if you need more power write your performance critical thing in a C++ dll, and call it from a Windows Forms or WPF application. It will save you hell of a lot time. Still my opinion, if you have another I totally respect that

    Upvotes: 1

    Whatever
    Whatever

    Reputation: 600

    My best advice for Windows C++ GUI programming is don't do Windows C++ GUI programming.

    I realize that is an extremely uninformative/smartass response if it's not qualified, so I'll note that you don't state that you need to do C++ Windows GUI programming, but that you "Would like to get into Windows GUI apps." If that is the case, and you don't have a very specific reason to use C++ (i.e. gigantic existing legacy codebase written in MFC or a bunch of C++ code that you want to build a front-end for but would be a pain to expose to .NET code), then it is going to be a lot easier and more productive to go the .NET route and start learning Windows Forms or better yet WPF using C# or another .NET language of your choice.

    If you do need to go C++, then I would second the recommendations for 3rd party toolkits like Qt or wxWidgets, as the state of C/C++ GUI programming tools from Microsoft is now abysmal.

    Upvotes: 4

    Foredecker
    Foredecker

    Reputation: 7493

    For C++ you have two choices, Native or Managed.

    For native development, my team (at Microsoft, in Windows) uses the Windows Template Library. It works very well for us.

    You should learn the basics of Win32 and how Windowing works. The canonical tome is Programming Windows®

    For Managed development you can use C++ with Windows Forms. However, windows forms has been supplanted by Windows Presentation Foundation (WPF).

    Upvotes: 7

    JPCosta
    JPCosta

    Reputation: 1257

    Are you familiar with Microsoft Visual Studio and .NET technologies? Since you want to develop for Windows platforms why don't you start by taking a look at Microsoft Visual C++ Express Edition.? Explore a little with the available tools from MS and search for some tutorials.

    Upvotes: 0

    rlbond
    rlbond

    Reputation: 67739

    I guess an important place to start is your toolkit. You tagged this visualc++, so I assume you are looking at that, however remember there are other toolkits like Qt.

    I would suggest starting at Microsoft's tutorials.

    Upvotes: 2

    Andrei Krotkov
    Andrei Krotkov

    Reputation: 5684

    Well, for the Windows GUI, get used to referencing the MSDN a lot, assuming you want to deal with the API directly.

    My favorite resource for learning the basics was theForger's tutorial, but there are hundreds of books and other sites out there.

    Upvotes: 3

    Related Questions