flat assembler
Message board for the users of flat assembler.

Index > Windows > DialogBoxParam+Menus

Author
Thread Post new topic Reply to topic
OzzY



Joined: 19 Sep 2003
Posts: 1029
Location: Everywhere
OzzY
Hi! I've done Dialog based programs with success. I use DialogBoxParam to call the dialog from a resource file. Ok, but when I add a menu it shows the menu when I'm editing the resource file in the visual resource editor, and the program compiles well, but the dialog will not show anymore.
What's the problem?

Thanks!
Post 14 Jun 2005, 15:01
View user's profile Send private message Reply with quote
senolc_eht



Joined: 22 Mar 2004
Posts: 57
Location: Indonesia
senolc_eht
hi..

I don't know what you mean but try look this code, this work well for me

Code:
include 'win32ax.inc'
.data
hinstance dd ?
.code
        start:

        invoke  GetModuleHandle,0
        mov     [hinstance],eax
        invoke  DialogBoxParam,eax,37,HWND_DESKTOP,DialogProc,0
        invoke  ExitProcess,0

proc DialogProc,hwnddlg,msg,wparam,lparam
        push    ebx esi edi
        cmp     [msg],WM_INITDIALOG
        je      wminitdialog
        cmp     [msg],WM_COMMAND
        je      wmcommand
        cmp     [msg],WM_CLOSE
        je      wmclose
        xor     eax,eax
        jmp     finish
  wminitdialog:
        jmp     processed
  wmcommand:
        mov eax, [wparam]
        cmp ax,102
        je wmclose
        jmp processed
  wmclose:
        invoke  EndDialog,[hwnddlg],0
  processed:
        mov     eax,1
  finish:
        pop     edi esi ebx
        return
endp
.end start
section '.rsrc' resource data readable

  directory RT_DIALOG,dialogs,RT_MENU,menus

  resource dialogs,\
           37,LANG_ENGLISH+SUBLANG_DEFAULT,demonstration
  resource menus,\
           2,LANG_ENGLISH+SUBLANG_DEFAULT,main_menu
   menu main_menu
       menuitem '&File',0,MFR_POPUP
                menuitem '&New',101,0
                menuseparator
                menuitem 'E&xit',102,MFR_END
       menuitem '&Help',0,MFR_POPUP + MFR_END
                menuitem '&About...',103,MFR_END

  dialog demonstration,'Create message box',70,70,190,175,WS_CAPTION+WS_POPUP+WS_SYSMENU+DS_MODALFRAME,2
  enddialog
    


my regard
Senolc_eht

_________________
sorry if i always asking.....
Post 14 Jun 2005, 17:18
View user's profile Send private message Yahoo Messenger Reply with quote
OzzY



Joined: 19 Sep 2003
Posts: 1029
Location: Everywhere
OzzY
For me works too. But what I said was with external resource editor. I put the dialog, add the menu, write the code. The code is ok, and it assembles, but the dialog isn't shown when I run the program.
But now after I tried more, I saw that it works ok with RADASM+FASM, but not with my C compiler (mingw). o.O

Thanks!
Post 14 Jun 2005, 17:34
View user's profile Send private message Reply with quote
senolc_eht



Joined: 22 Mar 2004
Posts: 57
Location: Indonesia
senolc_eht
Im sorry for my lacking, but i never uses external resource editor yet for my application, cause for me fasm is enough for now.

i'm sorry can't help you, but i have suggestion, why you not use hexedit or debuger and find the defference between compiled with fasm (directly)and using c compiler, maybe you will find something.

my regard,
senolc_eht
Post 14 Jun 2005, 17:56
View user's profile Send private message Yahoo Messenger Reply with quote
JohnnyReb



Joined: 25 Jun 2006
Posts: 8
JohnnyReb
I found that the example given didn't work for me. I had to change:

dialog demonstration,'Create message box',70,70,190,175,WS_CAPTION+WS_POPUP+WS_SYSMENU+DS_MODALFRAME,2

to

dialog demonstration,'Create message box',70,70,190,175,WS_CAPTION+WS_POPUP+WS_SYSMENU+DS_MODALFRAME,0,2

Then it worked fine!

Hope this helps someone.

_________________
JohnnyReb
Win if you can, Lose if you must, but always cheat!
Post 29 Jun 2006, 23:21
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.