.386 .model flat,stdcall option casemap:none include windows.inc include kernel32.inc include gdi32.inc include user32.inc includelib kernel32.lib includelib user32.lib includelib gdi32.lib WinMain proto :DWORD,:DWORD,:DWORD,:DWORD .DATA szClassName db "window",0 szAppName db "kanghtta",0 szText db "kanghtta is best prom...",0 .DATA? hInstance HINSTANCE ? ;hWnd HWND ? .CODE start: invoke GetModuleHandle, NULL mov hInstance, eax
invoke WinMain,hInstance,NULL,NULL,SW_SHOWDEFAULT invoke ExitProcess, eax WinMain proc Inst:HINSTANCE,hPrevInst:HINSTANCE,CmdLine:LPSTR,CmdShow:DWORD local @stWndClass:WNDCLASSEX local @stMsg:MSG local @hWnd:HWND mov @stWndClass.cbSize, SIZEOF WNDCLASSEX mov @stWndClass.style, CS_HREDRAW or CS_VREDRAW mov @stWndClass.lpfnWndProc, offset ProcWinMain mov @stWndClass.cbClsExtra, NULL mov @stWndClass.cbWndExtra, NULL push hInstance pop @stWndClass.hInstance mov @stWndClass.hbrBackground, COLOR_WINDOW+1 mov @stWndClass.lpszMenuName, NULL mov @stWndClass.lpszClassName, offset szClassName invoke LoadIcon,NULL,IDI_APPLICATION mov @stWndClass.hIcon, eax mov @stWndClass.hIconSm, eax invoke LoadCursor,NULL,IDC_ARROW mov @stWndClass.hCursor,eax invoke RegisterClassEx,addr @stWndClass
invoke CreateWindowEx,WS_EX_CLIENTEDGE,offset szClassName,offset szAppName,\ WS_OVERLAPPEDWINDOW,\ 100,100,600,400,\ NULL,NULL,hInstance,NULL mov @hWnd, eax invoke ShowWindow,@hWnd,SW_SHOWNORMAL invoke UpdateWindow,@hWnd .while TRUE invoke GetMessage,addr @stMsg,NULL,0,0 .break .if eax == 0 invoke TranslateMessage,addr @stMsg invoke DispatchMessage,addr @stMsg .endw ret
WinMain endp
ProcWinMain proc uses ebx edi esi hWnd,uMsg,wParam,lParam local @stPs:PAINTSTRUCT local @stRect:RECT local @hDc
mov eax,uMsg ;******************************************************************** .if eax == WM_PAINT invoke BeginPaint,hWnd,addr @stPs mov @hDc,eax
invoke GetClientRect,hWnd,addr @stRect invoke DrawText,@hDc,addr szText,-1,\ addr @stRect,\ DT_SINGLELINE or DT_CENTER or DT_VCENTER
invoke EndPaint,hWnd,addr @stPs ;******************************************************************** .elseif eax == WM_CLOSE invoke DestroyWindow,hWnd invoke PostQuitMessage,NULL ;******************************************************************** .else invoke DefWindowProc,hWnd,uMsg,wParam,lParam ret .endif ;******************************************************************** xor eax,eax ret
ProcWinMain endp end start
|