注册 登录
编程论坛 汇编论坛

32位汇编MessageBox的问题

Agdmeg 发布于 2012-11-02 16:51, 611 次点击
假如程序中调用MessageBox函数:
invoke MessageBox,NULL,offset ExitMsg,offset AppName,MB_OKCANCEL
我要怎么样才能处理MessageBox中单击“确认”按钮这个消息?
4 回复
#2
有容就大2012-11-02 21:50
看下这个怎么样
程序代码:
;  #define IDOK 1
;
  #define IDCANCEL 2
;
  #define IDABORT 3
;
  #define IDRETRY 4
;
  #define IDIGNORE 5
;
  #define IDYES 6
;
  #define IDNO 7
;
  #if(WINVER >= 0x0400)
;
  #define IDCLOSE 8
;
  #define IDHELP 9

        .386
        .model flat, stdcall
        option casemap:none
  
include       windows.inc
include       gdi32.inc
includelib    gdi32.lib
include       user32.inc
includelib    user32.lib
include       kernel32.inc
includelib    kernel32.lib      

         .data?
hInstance     dd    ?
hWinMain      dd    ?

        .const
szText        db    'xx', 0
szTextOne     db    'gg', 0
szCaption     db    'oo', 0
szCaptionOne  db    'jj', 0

        .code
_WinMain    proc   

        invoke    MessageBox, NULL, offset szText, offset szCaption, MB_YESNO or MB_ICONQUESTION
        cmp       eax, 6
        jne       ok
        invoke    MessageBox, NULL, offset szTextOne, offset szCaptionOne, MB_OK
    ok:    ret

_WinMain endp

start:      
        call      _WinMain
        invoke    ExitProcess, NULL
        end       start

#3
Agdmeg2012-11-03 00:19
貌似可以,那这样为什么不行?
 invoke    MessageBox, NULL, offset szText, offset szCaption, MB_YESNO or MB_ICONQUESTION
.if eax==IDYES
  invoke .....
  ....
#4
无敌小默然2012-11-07 09:40
在eax中有调用这个函数的返回值,就是MB_OK
#5
水哥2012-11-07 12:50
#define IDOK 1
#define IDCANCEL 2   
#define IDABORT 3   
#define IDRETRY 4   
#define IDIGNORE 5   
#define IDYES 6   
#define IDNO 7   
#if(WINVER >= 0x0400)   
#define IDCLOSE 8  
#define IDHELP 9
1