1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
| .386 ;指令集 .model flat,stdcall OPTION CASEMAP:none
;__UNICODE__ EQU
include windows.inc include kernel32.inc include user32.inc include Gdi32.inc
includelib user32.lib includelib kernel32.lib includelib Gdi32.lib
.const CLASS_NAME db "MainWClass",0 WINDOW_NAME db "51ASM",0
.code MainWndProc proc hwnd:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM .if uMsg==WM_CLOSE invoke PostQuitMessage,0 mov eax,TRUE ret .endif invoke DefWindowProc,hwnd,uMsg,wParam,lParam ret MainWndProc endp
START proc local @wcx:WNDCLASSEX local @hInstance:HINSTANCE mov @wcx.cbSize,sizeof @wcx mov @wcx.style,CS_HREDRAW or CS_VREDRAW mov @wcx.lpfnWndProc,offset MainWndProc mov @wcx.cbClsExtra,0 mov @wcx.cbWndExtra,0 invoke GetModuleHandle,NULL mov @hInstance,eax mov @wcx.hInstance,eax invoke LoadIcon,NULL,IDI_APPLICATION mov @wcx.hIcon,eax invoke LoadCursor,NULL,IDC_ARROW mov @wcx.hCursor,eax invoke GetStockObject,WHITE_BRUSH mov @wcx.hbrBackground,eax mov @wcx.lpszMenuName,NULL mov @wcx.lpszClassName,offset CLASS_NAME mov @wcx.hIconSm,0
invoke RegisterClassEx,addr @wcx .if eax==0 ret .endif
invoke CreateWindowEx, NULL,\ offset CLASS_NAME,\ offset WINDOW_NAME,\ WS_OVERLAPPEDWINDOW,\ CW_USEDEFAULT,\ CW_USEDEFAULT,\ CW_USEDEFAULT,\ CW_USEDEFAULT,\ NULL,\ NULL,\ @hInstance\ NULL
mov @hWnd,eax .if eax==0 ret .endif
INVOKE ShowWindow,@hWnd,SW_NORMAL
;消息循环 .while TRUE INVOKE GetMessage,ADDR msg,NULL,0,0 .if eax==0 .break .elseif eax==-1 .break .endif invoke TranslateMessage,addr msg invoke DispatchMessage,addr @msg .endw invoke ExitProcess,0 ret START endp
end START
|