Top

C++/Win32: Polishing the GUI

March 2, 2008

This is going to be the shortest lesson of them all, because I’m not going to go into much detail about what I’m changing in the code. You should by now be quite familiar with the code — familiar enough that you should be able to recognize and understand the changes made to it in this lesson.

This is the point in which I usually clean up the interface. Everything works the way I want it to, a lot of the bonus features are in place and functional. The only thing that really needs to get done is making the non-skinned GUI look presentable. Right now, it looks like this thing was just slapped together in a few minutes.

In the process of polishing the GUI, the majority of the work will be repositioning and resizing control elements, changing a few colors, and changing the window styles of elements. Most of what we’ll be doing can either be done at the time of creation, or set later in the program using the SetWindowLong function. We’ve seen that function already, so we don’t need to cover it again.

I’ve added two group box elements (which are just BUTTON class window objects with the style BS_GROUPBOX) to group control elements while in non-skinned mode, and I’ve hidden those elements while in skinned mode. I’ve cleaned up the icons, and provided a new bitmap for the skin. And I have replaced the static window elements by using the more sensible TextOut function. I haven’t covered the GDI yet, so the use of TextOut might be a little confusing, but I will cover that in a later lesson.

Look over the code, pick out the changes, and compile it to see a new, improved GUI. It’s certainly not the most beautiful thing you’ve ever seen, but it does definitely look presentable.

We will add more buttons near the unskin button in future lessons to extend our future functionality to the skinned mode, so make sure you understand how we are managing that button now.

Next: Resolving DNS.


Source Code:

win32tut_part11.zip [3.10MB zipped]

Additional Information:

· TheForger’s Win32 API Tutorial

Further Reading:

· Nitty Gritty Windows Programming with C++ by Henning Hansen.

· Thinking in C++ by Bruce Eckel.

Comments

Got something to say?





Bottom