Getting back into Windows programming - c++

I've been out of the Microsoft stack for a while now, been focused on Linux, open source stuff and web development in PHP. I used to do some desktop app development and some DirectX stuff on Windows in Dev Studio (all C and C++).
I'd like to brush up on the MS stuff just to keep up on what's going on. I've installed MSVC++ 2008 Express but I'm looking for a little side-project to play with. Given my background in C/C++ and familiarity with MFC and STL, what would be a good way to jump back in?

I've been developing on Microsoft stack since 1997, starting with C/C++/MFC/ATL, but all of the recent projects were on .NET platform (C#), so I would recommend learning .NET/C#. C/C++ still has its place, but it loses relevance rather rapidly. If not for legacy projects, we would not even bother with C/C++. Just my 2 cents.

If you want to get back into modern Windows programming you should learn C#/WPF.

If you're looking to get back into windows programming C# ASP.NET 3.5 is a fairly common and current language and framework to start with. This is the direction that the masses of C# .NET guys have been migrating as of late and you may be able to find a wealth of communities and bloggers contributing to that scene.
From the sounds of it, however, it looks like you were doing something along the lines of game development (DirectX and C++). Although more niche and slightly dated there are still a great deal of coders using the language. One of my favorite stops is GameDev.net because of the active community and active forums.
Good luck and have fun!

You could check out the VC++2010 beta, which comes with C++0x support and some MFC updates.
Since you're experienced with Linux, you might want to check out Qt for Windows too.

I fancy wxWidgets very much. It portable, effective and easy to learn especially if you've got some experience from MFC.

Related

Creating GUIs in Win32 C++

I'm developing my first Windows desktop application and I'm trying to figure out what the best approach would be to create the program's GUI.
I know, I know... I feel stupid for asking considering the amount of data on the subject on SO. However most answers seem outdated and I'm not sure if they fit my specific project. Also tutorials for Windows 8 'metro apps' are clogging my Google search results, which is NOT what I'm looking for.
I use Visual Studio. I've followed tutorials. I have basic knowledge of C and Java and extensive experience with PHP. I'm excited to learn C++, so I'm not looking for GUIs to create a GUI (like WinForms). I also don't care about managed code and portability for now, especially since I'm trying to avoid dependencies (i.e. users having to install .NET). As long as it runs smoothly on Vista and up, I'm happy.
The application
The software will teach basic physics to kids. I'd like to create a main area and a sidebar. The main area will feature a physics animation, say a bouncing ball, along with some Q&A. Users can zoom in to the animation to measure some stuff and answer the question. Users can track their progress in the sidebar. That's pretty much it.
What I've found so far
I'm getting a bit frustrated with MSDN. Most of their examples are given in four different languages (C#, C++, etc). I can't seem to get more than a bit of Hello World code from them.
I found a GDI API on MSDN and it seems like a good start for me. However I've read quite a few answers on SO saying creating layouts in pure C++ is really hard, that we're better of using frameworks like ATL and WTL. Since I'm also going to create (somewhat interactive) animations, I've wondered whether I should use gaming-targeted APIs like Direct2D.
Since all of this is new to me, and there are a lot of options, I don't know where to start for my particular application. Any tips would be greatly appreciated!
Using the raw Win32 API (no additional downloads or third-party helpers):
Here's a good primer (introduces dialog boxes, text boxes, buttons, etc): theForger's Win32 API Tutorial
And here's where you go from there (numeric up-downs, list boxes, combo boxes, tooltips, and more): Common Controls on MSDN. Most of these require you to #include <commctrl.h>.
I also found this to be a good resource that covered what the other two didn't: Win32 Developer - Window Assets
But the Win32 API doesn't seem like it does exactly what you want. A physics app for kids should have a more visual GUI than the API can provide. Good luck, though!
If you're ok with adding additional Frameworks, I'd suggest looking at Qt.
It allows to create the GUI from code only, has a good structure, and has an Interface for 2D drawing, if required.
If you are concerned about dependencies, you only have to include the Qt DLLs to your executables; no installation is required for the user.
To get started, see my (old) tutorial "Lessons in Windows API Programming".
But you really need a good book, such as edition 5 or earlier of Charles Petzold's classic "Programming Windows".
The problem with latest edition is that it's for C# and .NET, with Charles grabbing the tail of the "new way" at just the wrong timeā€¦
Disclaimer: I haven't checked the details of edition numbers.
Using the Windows API is the simplest, but producing advanced GUIs can take a very long time. Microsoft Foundation Class is a way to make the Windows API more user friendly and OOP. Does anyone have any experience with MFC?
Why not use some 2D C++ game engine, like HGE: http://hge.relishgames.com/overview.html.

Rich User Interface Application in Visual Studio

I am a noob C++ Programmer.
I want to develop GUI applications. I am using Visual Studio 2010.
Normally, Visual Studio Projects begin with the old style interface with a frame with a menu in it. But I want to build an application with more rich Graphical elements. Just like the windows 8 start screen.. or the Visual studio start page. Please teach me how to do those fancy effects.
Edit: I don't like to use flash or JavaFX Java because they need additional programs to be installed before using.
Well, basically you have not much options here. Regarding to your choice (MS Visual Studio) they are:
MFC/C++ - not convinient at all, I can say it's a small pain in the ass. But a lot of program were written exactly with a help of MFC library. It's a canonical way :)
Windows Forms/C++ - actually it's not usial C++, but C++/CLI. Not so much different, but has a few things to note. You can take a look at C++/CLI Cheat Sheet for example. Not usial, but, hey, you can use Windows Forms!
Windows Forms/C# - as for me, this combination is almost perfect. Nothing to add.
WPF/C# - even much more interesting. Any control can be modified in any way, but you have to know a lot of tricks and howtos to make all things work. In that case I highly suggest to use WPF Toolkit. Anyway, you can find a lot of cool stuff for WPF (I even made once a mini-SCADA with a bunch of UI elements related to industrial stuff (valve, pumps, etc.)). Do not forget, you can do animation as well. It is pretty easy.
Qt addon for MSVS/C++ - the last but not the least option. All UI you make in Qt Quick - GUI IDE. Also you have a greatiest slot/signal interaction model (which was improved in Qt5.0).
My choise now is definitely Qt. It's crossplatform, btw.
For C++ you can create a WinForms (Windows Forms) project.
But nowadays WPF is preferred over WinForms, and WPF is usually used from C# or VB.NET. I'm not sure if it's possible to use from C++, but if so it would have poor support. C# is pretty easy to learn if you already know C++.
If you want to create Windows Store apps in Windows 8, you can also use C++/CX, but that requires VS 2012.
So you really want to make flashy things like these, eh? Well, you can make a Windows Store app, but like previously mentioned it requires Visual Studio 2012.
Take a look at this question too: How to develop unique GUI's in Visual Studio?
You have several options of GUI from which you can choose wxWidgets, Qt, Ultimate++.
or u can use Embarcadero C++ Developer ----> actually Firemonkey is so amazing check it out
C++ Builder

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.

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!