Windows Dialogs

Started by
5 comments, last by Buklenios 15 years, 8 months ago
Just as one can painstakingly create a Windows menu using CreateMenu() and AppendMenu() instead of using a resource script, is there an equivalent option with Dialogs? Or do you *have* to define Dialogs in a .rc file?
Advertisement
A window is a window is a window and CreateWindowEx makes a window.
bitshifter,

So what you're saying is that I could just use CreateWindowEx to bring other windows to screen, each which have their own child controls. If this is the case then I think that's what I would do.

But why then, does the Windows API even dabble in the concept of "Dialogs." Why is there a Dialog API, Dialog Procs, etc.? Clearly by choosing your proposed CreateWindowEx strategy, I am missing out on some major/powerful functionality, no?
Under the hood dialogs are nothing more than a certain window class. There is no direct way of simply creating a dialog with the same behaviour from scratch besides CreateWindow(Ex).

Note that any of the DialogBox functions does a tad more than just create the dialog from a template. It also shrink-wraps the WindowProc functionality down to a DialogProc (which behaves a bit different).
Plus it exhibits a modal behaviour (the function returns once the dialog is closed).

You can use CreateWindow to create a dialog like window, but you also end up with a WindowProc, not a DialogProc. Also, you have to implement modal behaviour yourself if you need to (which is not too well documented).

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

Quote:Original post by plywood
But why then, does the Windows API even dabble in the concept of "Dialogs." Why is there a Dialog API, Dialog Procs, etc.? Clearly by choosing your proposed CreateWindowEx strategy, I am missing out on some major/powerful functionality, no?

Dialogs are very easy to use, they make designing interfaces quick, and require a lot less code. If you need the things that CreateWindowEx() provides that dialogs dont provide easily then use CreateWindowEx(). If not, then dialogs can make your life much better.
Here is a link to a demo i wrote for a dude last year...
http://www.codeguru.com/forum/attachment.php?attachmentid=20817
It demonstrates how to implement custom buttons with bitmaps.
Yes its not a dialog, but the principle is the same.
I did not use any of the common control stuff to do it!
You can create dialog templates in memory at run time instead of rc files. Have a look at:
http://msdn.microsoft.com/en-us/library/ms644996(VS.85).aspx

This topic is closed to new replies.

Advertisement