[win32] GUI, window/dialog

Started by
5 comments, last by remdul 16 years, 6 months ago
I'm creating a small setup program. It consists of a single window, where the user selects and enters a few things, installation folder etc. The user can click on a 'Next' or 'Previous' button to go to the next/prev step. I want to create the individual forms in a designer (stored in resource), but still want to use a single manually created window to display them (i.e. not destroying/creating windows when going to the next step). I want to swap a group of controls on each 'page' with another, some controls like a header image and prev/next button should remain unchanged. Only part of the client area changes. What's the best way to do this? How can I use dialog controls (.rc) on another window? (PS: Does anyone know of a free/open-source win32 form designer?)
Advertisement
Look up 'property sheets' in the platform SDK. These allow you to page between dialogs inside a single window. Each dialog (and the main window) can be set up in the .rc file.

Visual Studio C++ Express may have a dialog designer and it's free.

If this is just an installer, you may want to do it in C# / Windows Forms and save a lot of effort. The C# Express is also free.

Skizz
I think the Express edition (which I am using) only supports this for .NET, which I'm trying to avoid because of the massive dependencies on the .NET framework. The reason I'm creating my own installer is that I have some very specific requirements, and MS Installer is completely unreliable, and most other commercial installers involve to much bloat (unzipping, verifying, decompressing, copy to temp, copy to folder, cache here, cache there etc etc). Most installers have at least 3 complete copies of the entire installation scattered across harddisks at some point, this makes no sense and is utterly unacceptable.

I still have good ol' VC6 lying around, unless I can find a better IDE. :)

Yes, property sheets seem to be what I was looking for, thanks!
Oy, I now remember why I never used the VC6 form designer; for the life of me I cannot find the tool window where you can type in the position coordinates and size of a control. Does it even exist? Right now I'm doing this by editing the .rc files manually, but this the exact thing I'm try to avoid. :-/
The only thing eluding me right now is how to display the 'designed' property sheet on the main window. I vaguely remember that SetParent can be used, however I need the window handle of the container for that. How do I do this?

I tried CreateDialog() but it returns NULL:

HWND ctl = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_TEST), hWndParent, (DLGPROC)MyDlgProc);

I think it has to do with the MyDlgProc callback. I'm casting it to DLGPROC, since that is what CreateDialog wants, so I'm not sure why it doesn't work without the cast.

[Edited by - remdul on October 3, 2007 7:46:47 PM]
Quote:I still have good ol' VC6 lying around


There is nothing good about VC6. It doesn't support C++ in any modern sense, it was released before the standard was standardized. I'd recommend updating to the free Express Edition if you have any plans of using C++ in the future. The standard library is also very invaluable.

Good luck with your installer. I swear I've seen ones that do what you want already btw.

"Those who would give up essential liberty to purchase a little temporary safety deserve neither liberty nor safety." --Benjamin Franklin

Quote:There is nothing good about VC6. It doesn't support C++ in any modern sense, it was released before the standard was standardized. I'd recommend updating to the free Express Edition if you have any plans of using C++ in the future. The standard library is also very invaluable.

True words. To bad MS crippled the Express IDE to force people to switch to .NET. I really don't want to use VC6 for my forms stuff since I still need to alter the files in order to compile (replace #include "afxres.h" with <windows.h>). I might try some open source IDE, but so far VC Express is pretty good (minus the Intellisense hang bug and SP1 installer issue).

Quote:I swear I've seen ones that do what you want already btw.

Yeah, I did too, but that was many, many years ago. I still believe todays installers are rather crappy these days. I have had countless problems with MS Installer. With other installers I wasn't able to install software a number of times, just because all the copies of the installation data left no disk space left for the final copy that would go in the program directory.

I have checked out a few simpler installers, but they lack the advanced features. My installer requires things like downloading product key files, storing them, downloading and displaying a EULA before downloading updates etc.

And it's a good exercise to refresh my Win32 skills. :)

---

I figured what I was doing wrong, guess what? The dreaded InitCommonControls() call was missing. Works like a charm now. :)

Thanks for the feedback. :)

This topic is closed to new replies.

Advertisement