Sign in to follow this  
plywood

Windows Dialogs

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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).

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this