Modern books on native C++ development [closed] - c++

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I was going through the Hilo tutorial series Developing C++ Applications for Windows 7; seemed pretty interesting.
What modern books that go into details of developing C++ based applications for Windows 7? It should show how to take advantage of Windows 7 features and based on "modern" C++ (templates, Unicode, etc.). Not looking for old school Petzold or MFC type books (sorry). Also should feature native code development (i.e. no Qt-/wx-type 3rd party libraries). The 3rd party libraries seems to be at least a generation behind and don't seem to leverage the latests features (ex. Ribbon, Animation etc.).

I'd recommend that you ensure you're familiar with the theory in winprog.org/tutorial, then Ivor Horton's book (below), and then finally check out the WTL library.
The examples on the ribbon code in the Hilo articles use the windows API, which relies on COM objects to create the ribbon. ATL constructs like the CComPtr manage the lifetime of the ribbon objects and interfaces.
Because of this, I'd recommend that you ensure that you understand the basics of writing COM client code - e.g. You should understand CoCreateInstance, QueryInterface and smart pointers. ATL Internals (search on Amazon) is the essential reference on COM, but it is heavy going.
WTL wraps the detail of creating the ribbon and accessing it, but WTL was made for COM programmers looking for a windowing API, so it's not an easy API to begin with if you don't have experience of COM programming with ATL.
WTL supports the latest windows features, like ribbons etc. Don't expect any books on the subject though, there aren't any. M$ open sourced WTL some years ago, so the code is available to read, so you can figure out how everything works by reading the code. It's quite advanced though, you may want to look at it after you've had a look at the alternatives first.
Google uses WTL for the UI for Chrome.
I suspect you should Start with Ivor Horton's beginning Visual C++ 2010, it'll be a good all round introduction.
If you're looking for a great programming book for windows though, you can't do better than windows via c/c++ by Jeff richter - by far the best windows coding book I've ever bought.
If you are interested in WTL, then look at Michael dunn's series wtl for mfc programmers on code project.
Finally, there is no one book that hand hold the would be c++ GUI developer through all this, and that's a big gap in the market. I've often wondered why no one has picked up on this, given the popularity of c++

I still think that Stroustrup's The C++ programming language is a required read (cover to cover) for every C++ programmer. Then, add the Essential C++/STL series by Scott Meyers for some additional tips and advice.

I don't know if it's still 'modern', but Modern C++ Design is a great resource on templates and generic algorithms.

Related

How do I go about making a GUI- enabled desktop app in "pure" ISO C++ [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
I am trying to make my first desktop app, but I am at my wit's end trying to understand C++/CLI. After several hours of trial and error, it seems to me that it is unrelated with C++( I may be wrong ). I am getting hard time making functions, classes, etc. work, and am unable to understand what is going on. So, I have decided to abandon it for the moment.
Please tell me whether I can make a GUI-enabled desktop app in "pure" C++, using just my Dev C++ compiler. Yes, it might be a better idea to use visual studio, but I want to return to it later. Right now, please tell me whether I can do it in "pure" C++, and if yes, how(i.e., any books, tutorials or some specific learning path).
And yes, the app is just for my learning purpose. So, the issues of cross-platform compatibility, etc. can be safely ignored.
Thanks in advance.
If you're stuck with Windows, some of the more popular choices are:
Microsoft MFC. Not for the faint of heart...
Qt. However, this is also not strictly ISO C++, as it requires a special pre-compilation step. But it comes with a very complete library, is cross platform and widely adopted. The documentation is excellent and the learning curve not very steep.
wxWidgets. Cross-platfrom, popular and standard C++ only. However, relies heavily on the pre-processor and code using it tends to become ugly... (that's my personal opinion...)
GTK+, which is pure C. There is a pretty decent C++ wrapper called gtkmm.
Qt is probably the best C++ GUI framework out there. It does include language extensions that are not 100% C++ but it comes pretty close. There are also tutorials to help you out.
Standard C++ does not come with a gui. There are certain libraries that you could use to create a gui in c++ such as:
Qt
WxWidgets
I hope this helps
Firstly, C++/CLI is not C++, its Microsoft's ".net that looks like C++" language. Ignore it, it was pretty much dead on arrival.
I'm not sure what you mean by "pure ISO C++", if you mean you want to create a GUI app using C++ without any special language features (eg C++/CLI) then you'll be looking at Qt nowadays. Its really rather good and is probably the best C++ GUI system there is today. You can also download the QtCreator IDE that will help you out. (its also all open source and your apps will run on mobile and Linux too!)
If you want something that is Windows-only then you could write old MFC apps (for the desktop) or if you want to be bleeding-edge then write WinRT apps. The native OS GUI features are available in both these systems.

FLTK, wxWidgets, GTK - light, easy and portable [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I know that it isn't first topic when somebody considering different GUI libraries. But I have a few specific questions and needs that "the others" didn't have.
(As usual) I'm novice programmer, learning C++ now (finishing thinking in c++) and my university wants me to learn some GUI for programming projects (I'm electronics student) - I'm writing this because personally I would like to know C++ a little bit better before learning some additional libraries. But reality is brutal in this case :).
I'm looking for simple (easy to write in) library that will work under windows, linux and embedded systems (embedded linux or any other lightweight ARM system, not necessary android) without much (best case - ANY) modifications. I would like this library to be lightweight (thats why I eliminated QT), easy to use with other libraries (for audio/video players or some network applications) and languages (I'd like to write also in C, which will be my primary language I believe, maybe some python, D or java). The documentation/tutorials should be also easy and simply written - my English skills are very basic, as you can see reading my post.
After googling for hours my vote is for GTK/GTKmm which allow me to use LXDE, XFCE and GNOME (light/medium/heavy) without installing additional libraries, write code in C, C++, D, Python, Java and almost every programming language that exists. On the other hand many peoples wrote that FLTK is very simple, most portable and probably the fastest one. WxWidgets has many positive opinions so... I just don't know, please help me.
Thanks for your replies,
Pawel
I heard that FLTK is lightweight but have never used so no much comments. I have used however GTK+ and wxWidgets. I would say go for wxWidgets as it is a wrapper around GTK+ in Linux. Apart from that here are added advantages
wxWidgets uses native widgets wherever possible
You can use wxBase library which makes it lightweight (at expense of some feature see this)
Great support than GTK+ IMHO (forum, IRC, mailing list, SO, et al)
Also you can read these entries
http://docs.wxwidgets.org/trunk/page_libs.html
http://wiki.wxwidgets.org/WxWidgets_Compared_To_Other_Toolkits
https://stackoverflow.com/questions/5141116/choosing-between-qt-gtk-and-wxwidgets
https://stackoverflow.com/questions/1257894/wxwindows-vs-gtk-for-cross-platform-gui-programming
http://www.gidforums.com/showpost.php?p=37761&postcount=8
I would personally suggest you go with wxWidgets!

Will using Qt in a big MFC Windows-only app speed up development? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I know there is a lot of Qt vs MFC questions, but I'll try to be very specific.
We have a big (10 years of development) C++ MFC application for niche industry. It's supposed to stay Windows-only and English-only forever. But we need to add a bunch of new designer-drawn GUIs and GUI controls (dialogs, buttons, custom lists, ...).
We can hire 1 or 2 new GUI developers to build these new interfaces, so we can afford to choose different technology than MFC.
Qt seems most promising and suitable to run side-by-side with MFC (oh, no, we are not reduilding the app from scratch).
It seems that most cited Qt advantages are irrelevant: cross-platform development, easy internationalization, opensource, non-GUI libraries (we don't need networking and have most of other features already implemented).
But Qt is also famous for its good OO design and they've introduced QtQuick recently. I'd like to give it a chance, so the questions are
In a commercial Windows-only project, what are substantional advantages of moving to MFC+Qt from of pure MFC, which is worth the trouble of learning Qt, integrating it in our build/deploy process and maybe paying for a commercial license?
In particular, will it speed-up the development if we build new GUIs in Qt and incorporate them in the app via QWinWidget?
Probably not.
If the gui and business logic are nicely separated then it might make sense to move the gui gradually to Qt or implement new parts in Qt - but we both know the gui/logic will be a horrible mixed together mess
If you are doing a rewrite (which is what the Qt will end up as) then if it's a regular business type app then using C#/.net is probably easier.
If performance is critical and you have a lot of domain knowledge tied up in well defined well separated c++ libs then a Qt front end would be worthwhile
Not basically answer to a question, but might be helpful as weel. I think another way to do GUI with newer tools is to use ActiveX and COM. I believe you can easily use ActiveX components in your MFC applications. Also there are many ways to create such controls. I was using Delphi to do controls that were successfully used in .NET WinForms applications, but as far as I know such controls can be created in .NET environment with little effort.

Which OO Framework provides the smoothest transition from the C WinAPI: VCL, MFC, or qt? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I am interested in the pros and cons of these three frameworks, for someone who is used to the WinAPI/C environment. The code to be turned OO is not very complex: about 3000 lines of code, mostly controls. I would like to make the program OO, to make it maintainable by others down the road. At the moment it is a big ball of C mud, and I want to recode it in C++ OO.
Which of those frameworks should I use?
Visual Component Library (VCL) is a library that was developed by Borland for their products (Delphi, and C++ Builder).
Microsoft Foundation Class Library (MFC) is library developed by Microsoft, and essentially is a C++ wrapper around the C WinAPI. It is not included with Visual C++ 2005/2008/2010 Express, though.
As the Wikipedia article for MFC says, Windows Template Library (WTL) is a C++ template library that is lightweight alternative for MFC. There is no official documentation, although it is being build here. (See this page for examples, controls, and utilities.) WTL doesn't have integration with IDEs, and it is not officially supported by the Product Support Services.
Qt is a cross-platform C++ framework which is available in three licenses (GNU LGPL 2.1 with Qt special exception, GNU GPL 3.0, Commercial Developer License). Being cross-platform, the framework is not a wrapper around the C WinAPI library. It has also bindings for different programming languages.
The API style used from Qt is the native one, in the latest versions; previously, it was emulating the native GUI (except where Qt is the native GUI, such as in KDE).
There isn't a simple, complete example, which is not too long, and too basic to make you understand the differences between Qt, and C WinAPI, but you can find some examples here. I will say there are specific concepts that are used through all the framework, such as the concept of signal (in short, the event raised from a widget), and slot (in short, the method called when the event is raised), which allows you to change what shown from a widget basing on the value of other widgets.
connect(xSlider, SIGNAL(valueChanged(int)), glWidget, SLOT(setXRotation(int)));
connect(glWidget, SIGNAL(xRotationChanged(int)), xSlider, SLOT(setValue(int)));
connect(ySlider, SIGNAL(valueChanged(int)), glWidget, SLOT(setYRotation(int)));
connect(glWidget, SIGNAL(yRotationChanged(int)), ySlider, SLOT(setValue(int)));
connect(zSlider, SIGNAL(valueChanged(int)), glWidget, SLOT(setZRotation(int)));
connect(glWidget, SIGNAL(zRotationChanged(int)), zSlider, SLOT(setValue(int)));
If you are looking for a library that allows you to build cross-platform applications, or in different programming languages, this is what I would choose. Keep in consideration the license under which you get Qt, thought.
If you want to create a C++ application running only on Windows, I would choose WTL too. Respect some years ago, it is easier to use it now, although there is not a support for IDEs, which means (for example) there isn't a wizard to create an instance of a UI class, or to create a sub-class of a GUI class.
MFC and WTL both are closest to WinAPI, because is just a OOP wrappers on WinAPI. This is a most short way to convert C code to C++. QT is more robust and modern, but you must make complete redesign your project. I suggest to use WTL.

QT or MFC which is better to learn [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I want to have working experience in c++ application programming. I am in dilemma to choose game programming or standalone programming. please suggest me which framework/API is beneficial for me to learn.
Qt mobile / QT gui programming , any other APIs ,
what about learning MFC instead of QT,
are there any other gui framework than qt
On the first part of the question: I suggest you try some lightweight programming in both directions.
Now on the part of what framework to use. If you truly decide on game coding only you would probably need to go with specialized framework/engine for game development. Still, Qt will let you do some game development so you can try it for game and standalone programing before you make up your mind.
Regarding the frameworks you suggested. MFC is not popular as before and probably will not be much supported by microsoft in the future. Qt and wxWidgets are popular frameworks that will allow you to do cross platform apps. I recommend Qt because it makes coding much easier, wxWidgets becomes more useful if you are really interested in making native apps for the major platforms.
There are a variety, with different benefits and limitations. MFC is pretty much just Windows, whereas QT is cross platform, and (IMO) much more in demand in the current job market (which until recently I was searching very tenaciously!) Another popular option might be WPF, which is Windows specifc.
Short answer: do QT until 'the next big thing (tm)' comes along.
I can't give you opinions here. To gain experience, start programming in whichever framework fulfills your requirements.
Qt is good enough, and there is wxWidgets as an option. These two are cross platform unlike MFC.
As for choosing between game programming or GUI programming, you can do both, one after another.
Hope this helps!
MFC is windows and if you are mainly targetting windows, WPF is the new Micorsoft desktop GUI standard. Having said this, most games do everything in a 3D API-native (OpenGL/Direct3D) manner, and the main platform-specific parts is the windowing and user input.
There also comes a tradeoff between using an existing User Interface library compared to rolling your own. You will find it quite hard to deeply integrate Qt or WPF widgets into your game as first class citizens, and may need to jump through some hoops to do certain custom behaviours. Doing it manually from scratch comes with the benefit of really learning what is going on and being able to do exactly what you want to do; but the cost of this is you arent leveraging an existing complete library.
My personal advice is to take some time to learn either Qt or WPF (Qt if you care about multiplatform, a lot of projects use Qt, but WPF is pickup up momentum, especially due to Windows 8) just to get an idea of what a UI API looks like from the client side. Also learn the basics of a graphics API (OpenGL or Direct3D). Then you will be in a much better position to make your decision. Ultimately I would recommend creating a non-game UI program, and a seperate game program. This will give you a much better idea.
In the context of a game, you can leverage Qt/WPF/etc in the area of tools and editors. But generally realtime in-game UIs use a tightly integrated 3D accelerated UI library. One such library is Scaleform (commercial, flash-based), and another is CEGUI (LGPL/MIT).