iczelion tut8[2]

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

本文简介:选择自 jimgreen 的 blog

    mov commandline,eax
    invoke winmain, hinstance,null,commandline, sw_showdefault
    invoke exitprocess,eax

winmain proc hinst:hinstance,hprevinst:hinstance,cmdline:lpstr,cmdshow:dword
    local wc:wndclassex
    local msg:msg
    local hwnd:hwnd
    mov   wc.cbsize,sizeof wndclassex
    mov   wc.style, cs_hredraw or cs_vredraw
    mov   wc.lpfnwndproc, offset wndproc
    mov   wc.cbclsextra,null
    mov   wc.cbwndextra,null
    push  hinst
    pop   wc.hinstance
    mov   wc.hbrbackground,color_window+1
    mov   wc.lpszmenuname,offset menuname        ; put our menu name here
    mov   wc.lpszclassname,offset classname
    invoke loadicon,null,idi_application
    mov   wc.hicon,eax
    mov   wc.hiconsm,eax
    invoke loadcursor,null,idc_arrow
    mov   wc.hcursor,eax
    invoke registerclassex, addr wc
    invoke createwindowex,null,addr classname,addr appname,\
           ws_overlappedwindow,cw_usedefault,\
           cw_usedefault,cw_usedefault,cw_usedefault,null,null,\
           hinst,null
    mov   hwnd,eax
    invoke showwindow, hwnd,sw_shownormal
    invoke updatewindow, hwnd
    .while true
                invoke getmessage, addr msg,null,0,0
                .break .if (!eax)
                invoke dispatchmessage, addr msg
    .endw
    mov     eax,msg.wparam
    ret
winmain endp

wndproc proc hwnd:hwnd, umsg:uint, wparam:wparam, lparam:lparam
    .if umsg==wm_destroy
        invoke postquitmessage,null
    .elseif umsg==wm_command
        mov eax,wparam
        .if ax==idm_test
            invoke messagebox,null,addr test_string,offset appname,mb_ok
        .elseif ax==idm_hello
            invoke messagebox, null,addr hello_string, offset appname,mb_ok
        .elseif ax==idm_goodbye
            invoke messagebox,null,addr goodbye_string, offset appname, mb_ok
        .else
            invoke destroywindow,hwnd
        .endif
    .else
        invoke defwindowproc,hwnd,umsg,wparam,lparam
        ret
    .endif
    xor    eax,eax
    ret
wndproc endp
end start
**************************************************************************************************************************

menu.rc
**************************************************************************************************************************

#define idm_test 1
#define idm_hello 2
#define idm_goodbye 3
#define idm_exit 4

firstmenu menu
{
 popup "&popup"
        {
         menuitem "&say hello",idm_hello

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

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

go top