Robbert
Robbert

Reputation: 5193

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!

Upvotes: 3

Views: 13773

Answers (5)

phazer
phazer

Reputation: 89

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?

Upvotes: 0

MatthiasB
MatthiasB

Reputation: 1759

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.

Upvotes: 3

Proxy
Proxy

Reputation: 1854

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!

Upvotes: 10

Yuan
Yuan

Reputation: 1157

Why not use some 2D C++ game engine, like HGE: http://hge.relishgames.com/overview.html.

Upvotes: -1

Cheers and hth. - Alf
Cheers and hth. - Alf

Reputation: 145239

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.

Upvotes: 0

Related Questions