Dialog instead of Main window...
I would like to know how I would show a dialog box rather than the main window.. I have everything ready, I just need to code it so that it automatically displays the dialog box. I already made it not draw the window. Just need the dialog box! Any help would be appreciated..
-Chazz
Please help, I have a deadline (tonight) and this has to be done. I did everything except make it so that it uses the dialog box when it runs..
-Chazz
There''s an online book that gives you an example of how to do this, its at This page. Check in the dialogs section, in the hexcalc example. I''ve made my own dialog-only application (which is what I''m assuming you''re doing) and could show you my source if the link doesn''t help.
Handle the WM_CREATE message of the main window. Do not show the mainwindow (i.e. don''t make give it the style WS_VISIBLE & don''t call ShowWindow).
WHen you receive a WM_CREATE message, create the dialog box with the DialogBox function. Once the DialogBox function returns, call DestroyWindow to destroy your app. That ought to do the trick.
WHen you receive a WM_CREATE message, create the dialog box with the DialogBox function. Once the DialogBox function returns, call DestroyWindow to destroy your app. That ought to do the trick.
==========================================In a team, you either lead, follow or GET OUT OF THE WAY.
If all you want is a dialog and no main window in the winmain you don''t need to create and register a new window manualy at all just use:
CreateDialog(
HINSTANCE hInstance, //You''ll have this
LPCTSTR lpTemplate, //From the resorce editor
HWND hWndParent, //no parent so set to null
DLGPROC lpDialogFunc //Just like winproc, only dirfferent.
);
This macro will create the dialog from your resource for you. There is no need for a parent window. Just set the parent HWND to null.
Hope this helps and is in time.
CreateDialog(
HINSTANCE hInstance, //You''ll have this
LPCTSTR lpTemplate, //From the resorce editor
HWND hWndParent, //no parent so set to null
DLGPROC lpDialogFunc //Just like winproc, only dirfferent.
);
This macro will create the dialog from your resource for you. There is no need for a parent window. Just set the parent HWND to null.
Hope this helps and is in time.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement