C++ GUI database programming - c++

What is the easiest way for GUI database programming using C++ and where I can find a lot of tutorials and documentation?
I looked at Qt, but didn't find good tutorials on doing that.
What do you think of MFC? Any resources to recommend for this?
Any ideas?
Thanks.

If you are on Windows I would definitely use Windows Forms. Otherwise, as you have mentioned: QT (I find QT documentation to be pretty good).

If you're just targetting Windows, I'd seriously look at Embarcadero C++ Builder.
The C++ compiler is not as compliant as some, but the VCL framework is ideal for GUI development, and comes with database-aware components straight out of the box.

Since you mention MFC, I assume you're on Windows. Why not Visual Studio C++ Express? It has a GUI builder that creates basic WinForms. There's plenty of documentation and tutorials on MSDN, especially for database interaction (as long as your database is Access, SQL Server, etc). While not fully featured, it is free.

Related

What is the best way for starting graphical interfaces programming in C?

I have some knowledge in C/C++ but only using the Console. I'd like to start programming some graphical interfaces, but I don't have the minimal idea where to start.
I've heard of GUI applications and DirectX applications. I'd like to know which is the best for start programming?
Which libraries also is good to use and some tutorials if possible.
What's your platform?
If you only care about Windows and don't mind an outdated technology, you can go to MFC way.
If you want a cross-platform GUI toolkit; there are several:
GTK
WxWidget
Qt
If you want something more about drawing, instead of boring GUI forms; then you can learn either:
OpenGL (cross-platform)
DirectX (Windows-only)
For simple uses, and if you're in Windows, you can use GDI+, which is also rather outdated.
Newer .NET platforms have GUI technologies with fancy names, though I'm not quite acquaintanced with them to suggest anything.
If you're using Windows 7, please take a look at the excellent Hilo series of tutorials for developing rich UI applications in C++. You may also find that this is a good excuse to begin learning C#/.NET, as GUI development is especially easy to do in it.
If you are on windows the best way to learn is use C++ Builder.
Embarcadaro ( or whatever ) offers a free version if you want. Just google C++ Builder.
If you're on Windows, go for Windows Presentation Foundation (WPF). Don't loose time on those traditional GUI-Toolkits, they are past. The present (don't dare to tell about future) are declarative, highly customizable 2D/3D/Multimedia integrated environments, such as WPF.

to program GUI app , what will be the must user and developer frendly toolkit in c++

i like to build desktop application , that will be must user friendly in view
what i mean is that the look and feel will be natural in the way the user used to see windows
apps .
and this toolkit/framework to be as much as possible easy fast to develop from the developer side in c++ .
Could we ask some more questions, what do you mean by user friendly(system integration easy keybingings/Accessibility)?
Which platforms(windows only? You seem to indicate this, if so xp-7?
Would fairly easy crossplatform support be a plus))?
Do you want a form builder? an ide? special libraries?
open source or closed source?
do you mind paying?
qt is probably the most recommended
option although there is also
FLTK
Juce
wxwidgets
gtk+(c based or use with gtk-- a c++ wrapper)
I'd go with Qt.
It's a mature cross platform library that is easy to setup and to use. There's also a ton of resources available. The QT designer can also help you to quickly create your forms. There's even a visual studio plugin for it!
As others have pointed out Qt is a great choice. I went through the same search when I started coding C++ coming from Delphi, and this is where Qt shined. It was the only option I found that offered a complete solution: GUI, DB access, cross-platform system calls (file-access, start-processes), XML, native platform configuration (text files in *nix, win-registry, etc), multi-threading.
It was a one-stop shop for everything I needed.

How do I create a non managed Windows GUI in Visual C++?

When I create a 'Windows Forms Application', the resultant program is a managed one. Creating a 'Win32 Application' results in a native one, but when I try to add a form I'm informed that the project will be converted to CLI if I continue. How do I design a native Windows GUI with Visual C++ 2008 Express Edition? I'm probably being very silly here, but I just can't figure it out.
Either use MFC, WTL, or straight Win32 API. You can't use forms (or any of .NET) without switching into managed code.
MFC is Microsoft Foundation Classes - the most common C++ windows library
WTL is Windows Template library - a better C++ windows library IMO
Win32 is CreateWindow, DialogBox, etc, everything else is a wrapper around the Win32 api.
You just need to avoid the managed libraries. Most likely, this will mean using MFC for the GUI, instead of Windows Forms. For details, see MSDN's MFC pages.
Unfortunately, VC++ Express Edition doesn't support MFC directly, so you'll have be more limited. It is possible to compile MFC projects using the Express Edition, but you lose all of the Wizards, etc. If you are serious about doing non-managed GUI development, you should consider upgrading to a higher level SKU.
Another option would be to use Qt for for GUI. It is now LGPL, so usable, for free, in even commercial C++ projects, and includes a full designer.
This is an answer to the linked question. Unfortunately, that has been closed by Robert Harvey because he thinks it is a duplicate. It is not, sorry Bob.
The best library for creating xll's is http://xll.codeplex.com. You can use that to create rudimentary user interfaces using Excel macros. One example of that can be found in the ALERT.FILTER macro in xll/error.cpp
As Reed Copsey, MFC would be the "default" way of creating a native unmanaged GUI on the Windows platform. However, MFC is not included with Visual Studio Express. Consequently, you would either need to upgrade to the full version or you could look into using a freely available C++ GUI library such as wxWidgets.
There is also wxFormsBuilder if you want a GUI editor.
You could also go down to the "bare metal" and code right to the Win32 API, maybe take some help from the common controls library. But you'll be entering a world of pain ;)
You would need to use a native application framework. For Windows this means MFC or the bare Win32 libraries. WinForms use .NET libraries in the background and therefore need to be managed.
Native applications don't use "forms". For a native application, you could create, for example, an MFC application. If you want it to be something like a form-based application, you can tell the wizard you want a dialog-based application, or (on the last page of the Wizard) have your view derive from CFormView instead of CView.
Alternatively, you might want to use WTL -- though that means writing essentially all your code by hand instead of using wizards and such.
Windows Forms is the name given to the graphical application programming interface (API) included as a part of Microsoft's .NET Framework, providing access to the native Microsoft Windows interface elements by wrapping the existing Windows API in managed code.
Wikipedia
Most of the above answers explain things pretty well - if you want to look into creating a pure Win32 Native App form (no MFC/WTL etc) take a look at the tutorials here: http://www.zetcode.com/tutorials/winapi/ for starters. That's the third time I've linked to this site on here, but his tutorials are very good.
Note - at this stage there's nothing "visual" about it except the result - it is all done in code, although that said I don't think it is too difficult really. It will definitely be good programming experience.
Windows Forms are a GUI framework written in managed code, so you cannot use Forms in a native application.
With a native application, you have to create windows. Programming Windows by Charles Petzold is the definitive how-to book for this. It's a lot of work compared to using a good framework. MFC (Microsoft Foundation Classes) is a framework for native Windows GUIs. I don't know if it comes with VC++ Express.
I noticed that no one mentioned JUCE which can be used to build cross platform user interfaces in C++. I thought it was pretty cool. Looks like it's been expanded to support mobile devices too since I used it.
Personal and Educational licenses are free. 'Pro' and 'Indie' licenses are relatively cheap.

Has anyone used smartwin (a Windows C++ GUI OS library)?

I am considering using smartwin for a Windows platform only C++ project but notice that there has not been a release for 18months since 2.0rc5 was released i.e. it appears that it is no longer maintained.
After playing with it seems pretty good, I like it's use of templates, signals/slots (via boost) and it will meet the project needs but I would like some experiences of other users who are currently using it to help me weight it up?
Have you looked at Qt instead? I think it has a lot of the features you're looking for, and would be much better supported, both in developer tools and framework maturity.
"...we really don't need a full application framework or cross platform portability - just a lite Win32 GUI framework that can be easily added to an existing app "
That is exactly what Smartwin was created for. Combine that with the Sally IDE, and you'll have a complete RAD development environment that is fast compact and complete. Note that Google is currently using WTL for their Chrome browser, but Smartwin is even more efficient than WTL.
Smartwin Also has a library called Winelib that they hope will make this also a portable environment in the long term.
Personally, if you want to go portable, I'd go with wxWidgets. However, if you are planning for sure to stay with windows, I'd certainly give Smartwin++ a look.
I, myself, would use wxWidgets, as thats what I usually use and am used to, so thats kind just a personal choice.
Good Luck.
-Donald
Consider using wxWidgets. It is mature, well supported library with lots of features.
Went for WTL in the end and that's been a pretty seamless and painless transition. Thanks for the comments and responses everyone.
Ultimate++
http://www.ultimatepp.org/

C++ UI resources

Now that I know C++ I want to get into desktop application that have a UI instead of Command Prompt stuff, where should I start?, and what are some good online resources?
wxWidgets is a cross platform GUI library for C++ (and other languages). The main site should have enough pointers to resources to get going.
You might also want to check out this question/answer here on stack overflow if you are specifically thinking of Windows
If cross platform support is important then I would second the suggestion to look at Qt. It supports Windows, Linux and the Mac. For free software it is free (there is a GPL version on Unix but not for Windows) but for comercial software it is not particulary cheap. There are now several books on Programming with Qt.
It does come with a large number of extra libraries for networking, parsing XML etc. It also has integration with Visual Studio on Windows.
One downside with Qt is that there are not as many add on libraries as with some other GUI frameworks. Ot will depend on the type of applications that you wish to write whether this is important to you or not.
I use Codegear's C++ Builder. It's C++ language support is not 100% but it more than makes up for it by having a great two-way RAD IDE and the ability to use a huge library of existing Delphi components.
How about QT? Its cross-platform and its is used in a lot of commercial softwares.
On Linux and maybe Windows, you can use Gtk+ with Glade. Gtk+ is the GUI toolkit. Glade is a GUI drag and drop GUI editor. If you came from Windows or Java and thought GUI programming is hard, this stuff is easy.
If marketability is a concern, then C++/CLI with WinForms and WPF which really translates to "just learn WinForms and WPF, regardless of what specific language you use".
CodeProject has a ton of WinForms/WPF samples/tutorials to get you started.
The Fox GUI Toolkit
Really decent tried-and-true toolkit with a very nice event system. I've used the Ruby port, and my Windows apps had a very native look and feel.
It might lack some features, but FLTK is an incredibly simple cross-platform GUI library.
If you are using Windows the traditional place to start is Petzold
There is a nice simple framework here which will help you on the way without abstracting too much away.
Get Visual Studio Express, and start with a MFC "Dialog Based" application. All the window toolkits mentioned are good, but MFC will look the best on a resume!