Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   C++ (http://www.programmingforums.org/forum15.html)
-   -   How to use resource dialog as application window (http://www.programmingforums.org/showthread.php?t=2364)

some1 Feb 20th, 2005 1:49 PM

How to use resource dialog as application window
 
Hello everyone :D

I wonder how can I use a dialog box that I created as a resource, as applications main window that receives all the messages. I mean, when I create a window with CreateWindowEx it creates a blank window and I need to use subsequent CreateWindowEx calls to add controls etc and its a big headache. How to make it use a dialog resource instead?

drewlander Feb 20th, 2005 8:39 PM

To make a dialog box the main window, inside of WinMain use the function :
:

DialogBoxParam(NULL, MAKEINTRESOURCE(IDD_DIALOG), NULL, (DLGPROC) DlgProc, 0);

some1 Feb 21st, 2005 5:36 AM

thanks :)
do dialog boxes receive WM_PAINT messages and whats the difference between creating the window by code +using CreateWindowEx for all controls and making a dialog box using a resource? Do their differ somehow (like receive different messages or smth because CreateWindowEx creates a "window" while CreateDialog creates a "modeless dialog")

I would really appreciate it if you could answer these questions :)

drewlander Feb 21st, 2005 6:24 AM

With a dialog box, you do not have to handle a WM_PAINT message.
And with the difference between the two, you are correct that they will receive messages differently. A message box will not receive all the messages that a "normal" WinProc would, but you may not always need to receive those messages. Dialog boxes are basically just a window that works with child controls.
Basically it comes down to how much control do you want/need. Dialog boxes cannot do everything , but many times you do not need to do everything.


All times are GMT -5. The time now is 4:24 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC