iczelion tut9[3]

[入库:2005年8月19日] [更新:2007年3月24日]

本文简介:选择自 jimgreen 的 blog

    .else
        invoke defwindowproc,hwnd,umsg,wparam,lparam
        ret
    .endif
     xor    eax,eax
    ret
wndproc endp
end start

分析:

我们现在开始分析,

        .elseif umsg==wm_create
            invoke createwindowex,ws_ex_clientedge, \
                            addr editclassname,null,\
                            ws_child or ws_visible or ws_border or es_left\
                            or es_autohscroll,\
                            50,35,200,25,hwnd,editid,hinstance,null
            mov  hwndedit,eax
            invoke setfocus, hwndedit
            invoke createwindowex,null, addr buttonclassname,\
                            addr buttontext,\
                            ws_child or ws_visible or bs_defpushbutton,\
                            75,70,140,25,hwnd,buttonid,hinstance,null
            mov  hwndbutton,eax

我们在wm_create中产生子控件,其中在函数createwindowex中给子控件窗口一个ws_ex_clientedge风格,它使得子控件窗口看上去边界下凹,具有立体感。每一个子控件的类名都是预定义的,譬如:按钮的预定义类名是"button",编辑框是"edit"。接下来的参数是窗口风格,除了通常的窗口风格外,每一个控件都有自己的扩展风格,譬如:按钮类的扩展风格前面加有bs_,编辑框类则是:es_,win32 api 参考中有所有的扩展风格的描述。注意:您在createwindowsex函数中本来要传递菜单句柄的地方传入子窗口空间的id号不会有什么副作用,因为子窗口控件本身不能有菜单。产生控件后,我们保存它们的句柄,然后调用setfocus把焦点设到编辑控件上以便用户立即可以输入。接下来的是如何处理控件发送的通知消息wm_command:

    .elseif umsg==wm_command
        mov eax,wparam
        .if lparam==0

我们以前讲过选择菜单想也会发送wm_command 消息,那我们应如何区分呢?看了下表您就会一目了然:
 

  low word of wparam high word of wparam lparam
menu menu id 0 0
control control id notification code child window handle

本文关键:iczelion asm
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top