hi all,

what is wrong on start a dialog without class definitio and without message loop, as follow..



all GetModuleHandleA, NULL
mov [hInstance], eax
call InitCommonControls


call CreateDialogParamA, [hInstance], IDD_MAIN, 0, offset DLG_Proc_Main, 0
call ExitProcess, 0


DLG_Proc_Main proc .....
cmp [wmsg],WM_INITDIALOG
je Create
cmp [wmsg],WM_PAINT
je Paint
...
...








It's the shortest way to write a simple dialog app but i'm not sure this method is correct. Seems work but It's without message loop...


B7
Posted on 2003-04-11 01:26:27 by Bit7
The normal way of creating a dialog app is to use DialogBoxParamA. That function provides its own message loop. It also prefers using EndDialog (instead of DestroyWindow) to close the window.
Posted on 2003-04-11 13:30:27 by tenkey
sorry, i was wrong on attaching the code. The function i've used was just DialogBoxParamA, not CreateDialogParamA.

But so, why using windowsclass & messageloop if i can use DialogBoxParamA ?
Posted on 2003-04-11 14:49:54 by Bit7
HI! a cool thing i found my self is that we can mix it together ,

for example we make a dialog with no buttons or any control at all
just the :

1000 DIALOG 203,188,200,143
STYLE DS_CENTER | DS_3DLOOK | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
CAPTION "dialog name"
FONT 8, "Helv"
BEGIN

END



then if we want to make a button or edit control for example we just do:


wm_inidialog:

call CreateWindowExA, NULL, "BUTTON","", WS_CHILD | WS_VISIBLE,200,104,27,25,, 101, , NULL



;)



it works fine!
Posted on 2003-04-12 17:34:34 by Nguga

why using windowsclass & messageloop if i can use DialogBoxParamA ?
I'm not sure it's possible to add modeless dialogs otherwise. Example of a modeless dialog is a find and search dialog that allows you to edit text in a main window without disappearing.
Posted on 2003-04-14 05:48:48 by tenkey
You can do modeless dialog boxes as well.
Bit7, dialog based applications are just fine, nobody says you _have_ to use a messageloop.
Posted on 2003-04-14 06:25:16 by f0dder