The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: Troy Lundin on June 05, 2006, 08:33:17 AM

Title: My window will not show.
Post by: Troy Lundin on June 05, 2006, 08:33:17 AM
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.
Title: Re: My window will not show.
Post by: ToutEnMasm on June 05, 2006, 12:17:01 PM
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
Title: Re: My window will not show.
Post by: KSS on June 05, 2006, 03:09:47 PM
Dialog (in res file) must have style WS_VISIBLE
or
in DialogProc process WM_INITDIALOG and show dialog:
Invoke ShowWindow,hWin,SW_SHOW
Title: Re: My window will not show.
Post by: P1 on June 05, 2006, 08:15:32 PM
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)
Title: Re: My window will not show.
Post by: dsouza123 on June 06, 2006, 01:47:04 AM
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