GUI easy and fast without .NET framework? - c++

Is there any way to build graphical interfaces in the same rapid and easy way we could do in Visual Studio, but without .NET Framework? I'm looking to native Windows GUIs, so using Qt with Qt Creator is not an option (and it doesn't need to be cross-platform). Something with the Windows API using C++ would be great (not Delphi).
I mean, applications like WinSCP really have its GUIs written entirely by hand?

Given:
You don't want to use Qt
You want to use Win API
The natural option is MFC. It's basically quite a thin wrapper around the Win32 UI API, but VS has an MFC UI designer that will save you a lot of work (no need to manually set the co-ordinates of controls etc.).

My vote is still on Qt.
I suspect OP is really confusing "Native" with "deployable in a single binary". You can achieve this also with Qt by statically linking Qt dependencies. Contrary to popular belief, the LGPL does not prohibit this either.
Now if OP is looking for "deployable in a single super small binary" utorrent style, the answer would differ. A discussion around small binaries seems a good place to look. I would say there is a price to pay in increased development time though.
But I can't agree on Qt not being as native as say MFC.

Another excellent option is C++Builder with the VCL. This is very similar to WinForms (whose design it clearly inspired) and much more productive than MFC in my opinion.

As both Qt and MFC are wrappers around the native OS functions for managing windows and other OS utilities (that use Win32 API under the hood and look completely native) there is really no reason to consider the use of MFC over Qt, as it is not more native than Qt. Either your definition of "native" is broken or you haven't told us the whole story.
But there are a thousand reasons for considering Qt over MFC, as the latter is a complete pain to use, whereas the former is a cleanly designed, easy to use and still highly flexible library (that strives for nativity by any means possible).
The only way you might see MFC as more native is that it comes from Microsoft (the same company that developed Windows). But that doesn't make it more native. It's still a third party library. This third party worked for the same company as the party developing the Win32 API, but that doesn't make it specifically more tied to the Win32 API, as both were developed independently (and surely by different people).
Do Qt apps look and feel native under Windows?

You could also take a look at wxWidgets.

In addition to MFC, you might want to look into the Windows Template Library.

Related

Porting Objective-C app to Windows. What are the best options?

I have a fully-working audio/video application which is entirely written in Objective-C (with bits of C/C++ and GLSL).
I now need to port it to Windows and I'm wondering what my best options are. I'd like to stay in the C/C++ domain so Java is not an option.
I know that this will be a lot of work but I also want this to be good (attention to detail is very important to me, I subclassed many UI elements to suit my needs).
Currently, I think that I could either port the whole app to C++ and use Qt for the whole UI (I did some small projects with that and found it mostly ok) or I could port the application core and write two different UIs for Windows and Mac (the Mac UI is already there of course).
Has anyone of you done what I'm trying to do and can give any insight? What's the best approach and why?
I have almost zero knowledge of Objective-C and macOS UI, but on Windows I think the best C++ OO tiny and efficient wrapper around native C Win32 APIs is WTL, based on ATL.
There's a quality series on WTL on CodeProject.
In the realm of Windows-specific C++ frameworks/libraries, you may consider MFC as well (which offers good integration with Visual Studio IDE), but honestly I prefer WTL: it's kind of more lightweight than MFC.
In addition, there's the cross-platform Qt alternative you already cited in your question.

What is the best way to get started in GUI C++ programming?

So, I learned C++ (fundamentals) and I want to write software, however I have stumbled upon a problem where I don't know where to get started. It seems like learning C++ was the easiest part by far when it comes to understanding the libraries for the GUI construction the concept I yet don't fully comprehend. I searched a lot and couldn't even decide been a new guy on MFC, Win32 or Qt.
Qt C++ GUI seems like a fun and easy to use software with the definitions of classes available right there quickly.
With Visual's MFC I am seeing a lot of code upfront on the pre made project file and a lot of description of classes, however getting definitions is a bit slower as I have to go to the internet.
Win32 is apparently written in C and is not updated much?
A lot of people recommend Java and C# as well, but I am not interested in learning a new language when I don't have C++ set in stone and practiced with enough yet.
Not sure how to go about this.
Go with Qt if you envision porting your program to platforms other than Windows and/or your actual UI needs are relatively straightforward. But Qt, being "fun," abstracts you away from the Windows API, so if you find yourself needing to access features of that API not offered by Qt, then you'll be up the creek. So go with MFC if you're staying on Windows and you're building an application whose complexity or Windows-specific features may require more direct access to the Windows API. MFC provides a thin abstraction layer over that API; its concepts map more or less one-to-one with the API's concepts.
What kind of GUI do you want? Any framework should be able to do any kind of GUI, but some are optimized for certain work:
MFC is optimized for making applications that edit documents, like MS Office programs Word, Excel, Powerpoint.
wxWidgets and Qt (and .NET WinForms and WPF) are optimized for any sort of app that primarily uses widgets (textboxes, buttons, menus).
SDL is optimized if you want to draw stuff, like graphs or vector artwork.
I wouldn't recommend that you use MFC since it isn't a good fit for most applications, and also doesn't use modern C++ design, it's loaded with workarounds needed for stuff that was broken in early versions of Visual C++ and now can't shake those workarounds because of backward compatibility.
The Win32 API is actually really useful to know regardless of what kind of application you want to make, because it defines the rules for how the UI interfaces to the rest of the system. Yes, it's written in C, but this is to make it usable from any programming language, not because it's an obsolete design. Win32 API is highly object-oriented and uses polymorphism extensively.
Few things you need to be aware of:
If one day you want to sell a program written using Qt you might need to purchase a license.
If you feel like GUI applications/ GUI programming is what you want to do in general, for windows platform you better learn WinForms or even better WPF (with C# of course).
If you just want to quickly put up simple GUIs for your C++ programs for learning purposes, and you don't care much about learning the frameworks and licensing issues, just go with Qt or wxWidgets.
MFC is outdated. If sticking with C++ on Windows, I recommend you to lean C++ CLI.
However I suggest you to learn c# directly since c# is the mainstream language in .Net world.
For GUI, the windows world is now dominated by WPF.

Windows GUI applications in VisualStudio

What are the valid ways to write (hopefully native) C++ applications with GUI in VS 2010?
I remember some 10 years ago I was using MFC, any big changes today?
If you want to stay with Native API then MFC is still a good choice or plain Win32 API.
There are new controls like the ribbon control introduced in VS2010. There's a tutorial on native development with VS2010 on MSDN. There are also a lot of C++0x features available to your native program if you're using VS2010.
Qt is another good choice even if you aren't going cross platform but you won't be using VS 2010 most likely in that case. The licensing is now free for commercial use with LGPL.
If you are going to use a newer framework like WPF from Microsoft then you will need to use a managed language (.NET). Another choice is Silverlight for both web and apps. Silverlight apps have the advantage that you can get them to work even on Mac if they have Silverlight installed. Winforms is still easy to code but mostly superseded by WPF.
Unless you have good reason to do so, you can develop much faster with a framework like WPF instead of MFC. Even if you don't know a managed language. (If you don't go straight to C# instead of C++/CLI). WPF also offers GPU acceleration.
You can use Windows Forms, or Windows Presentation Foundation (WPF) - in VS2010 you can use either of these to create apps with a GUI. In terms of which would be the best - I suppose that depends on your specific needs, but I couldn't say as I've only really used WinForms. However, WPF apps seem to have more components for you to use.
Just for completeness - not advocating it, wxWidgets is a cross-platform GUI toolset.
If you really want native, and you really want C++, your best option is WX. MFC has some nice controls and such but still lacks any semblance of a complete UI library. It lacks any layout managers, period and still suffers from being a basic wrapper to the win32 C API. WX has some of this latter issue as well but has been cleaned up considerably from MFC and has layout managers.
A couple other options:
You could break out of C++ and go with one of the .NET languages to use other, better native libraries.
You could use a cross-platform library that'll still have the look and feel of the native toolkits, like Qt or GTKmm.

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. For those of you who have taken this road before, what advice/tips can you give me. Ex: good readings, tutorials, approach tactics, etc...
I know this is a really broad question, but i really don't know how/where to start, thus not knowing how to ask this question properly.
I highly recommend the use of the Qt Libraries for several reasons:
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.
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!
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.
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.
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"?
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.
Honestly, I wasted a couple of years by developing software natively for Windows, while I could have been so much more productive.
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).
Here is a good site that can get you up to speed.
This tutorial is useful
You can use Visual C++ 2008 Express Edition for your tools (they are free).
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.
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.
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.
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.
+1 for Qt. 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.
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
The first question is that do you want to develop Free, Open Source, for personal use or Commercial applications in C++?
If you want to develop for personal use! Then you can go with some good C++ Toolkit, Framework or API.
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.
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?
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.
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.
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
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.
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.

Should I use a cross-platform GUI-toolkit or rely on the native ones?

On my side job as programmer, I am to write a program in C++ to convert audio files from/to various formats. Probably, this will involve building a simple GUI.
Will it be a great effort to build seperate GUIs for Mac and Windows using Cocoa and WinForms instead of a cross-platform toolkit like Qt or GTK? (I will have to maintain a seperate Windows-version and Mac-Version anyway)
The GUI will probably be very simple and only need very basic functionality.
I always felt that native GUIs feel far more intuitive than its cross-platform brethren...
If you have the expertise, use native frontends, it'll effectively double the job you have to do for UI but from my experience non-native UI is a little bit clunkier than their native counterparts.
Have you looked at wxWidgets? Cross platform native controls.
I would agree that if possible, native front-ends are the way to go. I've not used wxWidgets recently, and I've heard it's come a long way, but back when it was wxWindows, we built an app with it that was spec'd to be built in X/Motif. When we finished the effort and delivered it, the customer said it did not look enough like X/Motif, and we had to re-work the entire UI at our expense... Joel Spolsky wrote a good article on this, but I can't remember the title. What he did say, IIRC, was the problem with Java and some other cross-platform UI was that "your dog barks at my app" - it's the little inconsistencies that annoy folks.
Cross-platform toolkits, more or less, all make the incorrect assumption that the difference between platforms is a matter of button placement and widget styling. In some cases you can get away with this - a Qt app will feel fairly native on both Windows (where UI conventions are very lax) and on Linux, particularly a KDE environment. In general, you can move between Linux and Windows relatively easily; conventions are similar, and the Windows community is lax about them.
Mac is the hard one. Its UI is built around an entirely different paradigm than either Windows or most Linux environments.
But in general, in a native app it's easier to speak the native language of the platform in more ways than just widget style.
Yes.
But seriously, it depends on your goals. I agree that the native UI libraries, with a bunch of effort put into them, will give vastly better results, but for lots of apps, a very basic UI is sufficient and a lot less effort if you take one of the existing cross platform frameworks.
Maybe starting with the CLI and getting functionality working makes the most sense for an audio conversion application.
I'm going to write my own cross platform application GUI layer for this soon.
Depending on the complexity of your application this can be a fraction of what is required for QT, GTK or FOX.
Reason is that we see a tendency that the platform vendors (Apple first) tries to design there system so that it looks unique. This makes it much harder for QT, GTK, FOX and other platform tools to constantly keep in sync with the latest widgets.
When the underlaying technique becomes more and more the same the OS vendors have no option then branding on look and feel of the platform.
wxWidgets used standard c++ syntax and preprocessor thus make you easily alter from plain C or C++. And will produce very native look where is appear, be it on GTK, X11, MS-Windows or Mac.
It's mature since 20yrs of 1rst release, has complete documentation with easy navigating, and supported by large community arround the world.
Coding in your favorite IDE or use prominent Eclipse-IDE and wxFormBuilder as GUI designer. Build wx library and IDE/Toolchain setup could be found on this link: http://yasriady.blogspot.co.id/2016/01/raspberry-pi-toolchain.html
Develop your application in Linux desktop and also provided compiler for Raspberry Pi2 (target application tested work smootly on Raspbian Jessie) ............