Build GUI for Windows without using Windows API

Asked

Viewed 1,927 times

5

I have been searching the internet for a way to build graphical interfaces for windows without necessarily using Windows API.

I program in C# and for this, I have as solution WPF. However, I could not find any solution in C++.

My goal is to create a GUI such as Popcorn, Ccleaner, and others. In them, you can see that the interface was not made (at least it is what I think) in windows form and not based on the windows of other systems, as it could be a program for linux or macOS X, which brings a notion of sophisticated and different design.

I do not know if it was very clear, but the point is that there are programs with "standard" interfaces, are those that have an interface similar to the graphical elements of the operating system itself (windows, buttons, text box, etc) And there are programs that have their own interface style. I wanted a solution for C++ that gave me a direction for this.

  • From what I understand you are looking for a cross Plataform window manager for your application? If this is the case I recommend GTK, I used a lot with C#, but it works the same for other languages.http://www.gtkmm.org/pt_BR/index.html

  • In fact, at first, my interest was really to discover a solution that would give me a more personalized interface and not so much based on windows windows.

  • I think that more than not directly using the operating system schema your desire is to have a window with a totally own style, independent of the native style (given the examples of Popcorntime and Ccleaner). In that case, I would go by the answer already given, using Qt. You can simply "shut down" the native rendering of the window (using Qt::FramelessWindowHint) and then draw yours any way you want. Here is an example in Qt, with a semi-transparent window: http://www.qtcentre.org/wiki/index.php?title=ARGB-Widgets

  • Another more complete example (the page is in French, but nothing that Google Translation can’t help): http://qt.developpez.com/tutoriels/braindeadbzh/customwindow/

  • Take a look at [tour]. You can accept an answer if it solved your problem. You can vote on every post on the site as well. Did any help you more? You need something to be improved?

1 answer

6


If these softwares were not made with . NET, and as far as I know they haven’t, they don’t really use Windows Forms, which is nothing more than a layer on top of the Windows API.

When you want to manipulate windows on the operating system you don’t have much to escape from the window API of it. To what extent you will use all or only the main features and do the rest at hand is a decision of your or the library you want to use.

Most programmers prefer to use libraries that facilitate the use of the OS API.

In fact if your intention is to make an application that runs on more than one platform there are two alternatives: create a code to manipulate the screens on each platform or use a library that can abstract a good part of them.

If you are going to create a GUI system for each platform some options would be the MFC for Windows, GTK for Linux or Cocoa for Macos.

There are other options mainly for Windows but everyone complains that none is good enough. And they work well, but they’re usually hard-to-handle libraries.

It is possible to use GTK on other platforms but the result is not good. A Binding since this library was written in C.

It is almost impractical to use Cocoa directly in C++.

If the option is to create a single system for all of them the best options seem to be Wxwidgets and Qt.

The first uses the native resources a lot but it is not so simple to work with it and not always the result is adequate. The look works well but the experience leaves to be desired. I’ve seen some reports of bugs that are never solved.

The second does not always achieve perfect visual result but it is simpler to make everything work on all platforms. It even allows you to make the applications for the 3 major mobile platforms. Of course, taking advantage of desktop screens on mobile is not something that usually works. It is considered native in Linux and the look for Windows is very well played, fool around as much as or more than WPF which is also not perfect.

In almost all of them it is possible to make a custom look that escapes the standard of the operating system. But the problem is whether to change the behavior, the overall experience. As good as usability is on one platform, when it is applied on another, it doesn’t usually work very well.

Even if you want to use Windows-only as the question title demonstrates, you’ll probably prefer a higher-level library, like Qt. By its flexibility, it seems to be as close as you want it to be. But don’t take my word for it, search further.

Qt lets you make the look of the application look the way you want it to look. It allows your entire drawing to be customized.

Opt for MFC, ATL or WTL. that are official or almost official Microsoft options is not easy. Some find that the pure Win32 API is even easier :)

There are other options but few people use: eGUI, Ultimate++, Smartwin.

There is also a library VCL Builder, but only works with Embarcadero compilers.

The list does not end here, the amount of options is impressive.

This is the basis for you to research further and see what meets your need. But I warn you that none is perfect.

  • Very consistent response! I took a look here at Qt. At the level of interface customization, it really looks very good. It even reminds me a little of WPF, for using the QML language to do the interface. Thank you very much for the direction.

  • Does the library to use on a Linux system not depend on the interface installed on the system? For example, I use Gnome, which is based on GTK.

  • It depends, the library needs to be installed, but the fact that you use Gnome does not mean that programs written with Qt will not run. The GUI library is one thing, the desktop manager is another. Gnome is based on GTK, programs that run on it need not be.

  • You can have the 2 libraries (and several others) running in parallel. My phone is a Nokia N900, the original apps are based on GTK, but there is a lot of Qt running. Even the pyqt demos run perfectly on it.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.