I created a program with a resource file that contains a window with a button.
Now, the project builds fine (no errors) but when I try to run it, it doesn't show. As if the program appears then instantly disappears.
So far this is the only code I have.
DlgProc Proc hWin: DWORD, uMsg: DWORD, wParam: DWORD, lParam: DWORD ;The beginning
.if uMsg == WM_COMMAND
.if wParam == IDC_BUTTON0
invoke MessageBox, 0, readytxt, readycap, MB_OK
.endif
.endif
xor eax,eax
ret
DlgProc endp
Is there some special call I must make to show the window? Thank you.
Hello,
There is not enough code to say if the dialog box can be visible or not.
Join the call to the dialog and the ressource.
ToutEnMasm
Dialog (in res file) must have style WS_VISIBLE
or
in DialogProc process WM_INITDIALOG and show dialog:
Invoke ShowWindow,hWin,SW_SHOW
Troy,
Welcome Aboard !!! :U
Pull out one of the Dialog examples from MASM32 Examples and work forward from there.
Otherwise post the project for us to diagnose the problem.
Regards, P1 :8)
Though this part doesn't address the DialogBox not showing issue,
there are errors in the syntax of the MessageBox call.
The addr operator is missing before both of the two string parameters.
Also make sure readytxt and readycap are zero terminated strings.
readytxt db "Ready Text",0
readycap db "Ready Caption",0
invoke MessageBox, 0, readytxt, readycap, MB_OK
should be
invoke MessageBox, 0, addr readytxt, addr readycap, MB_OK
------------------------------------------------------------------
Now for the issue of the dialogbox not showing :
Did you compile the resource file ?
Did you do a (Windows GUI) assemble and link versus a Console assemble and link.
If you are using the MASM32 Editor in the menu there is
Project
--> Compile Resource File
--> Assemble & Link
The resource sourcecode file rsrc.rc will get compiled to rsrc.res and rsrc.obj
Your assembly file filename.asm will be assembled to filename.obj
and will be linked with the resource file rsrc.obj to form filename.exe