.386
.model flat,stdcall
option casemap:none
include C:\masm32\include\windows.inc
include C:\masm32\include\user32.inc
include C:\masm32\include\kernel32.inc
includelib C:\masm32\lib\user32.lib
includelib C:\masm32\lib\kernel32.lib
.data?
hInstance HINSTANCE ?
h_window HWND ?
h_button HWND ?
.data
AppNameDefault
db "FD3",0
; Classen Namen
btnClass
db "BUTTON",0
.code
START:
Window proc
LOCAL wc:WNDCLASSEX
LOCAL msg:MSG
LOCAL CoordRect: RECT
invoke GetModuleHandleA, NULL
mov hInstance,eax
mov wc.cbSize,SIZEOF WNDCLASSEX
mov wc.style, CS_HREDRAW or CS_VREDRAW
mov wc.lpfnWndProc, OFFSET EVENTS
mov wc.cbClsExtra,NULL
mov wc.cbWndExtra,NULL
push hInstance
pop wc.hInstance
mov wc.hbrBackground,COLOR_BTNFACE + 1
mov wc.lpszMenuName,NULL
mov wc.lpszClassName,OFFSET AppNameDefault
invoke LoadIconA,hInstance,500
mov wc.hIcon,eax
mov wc.hIconSm,eax
invoke LoadCursorA,NULL,IDC_ARROW
mov wc.hCursor,eax
invoke RegisterClassExA, addr wc
INVOKE CreateWindowExA, NULL, ADDR AppNameDefault, ADDR AppNameDefault,
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 800, 600,
NULL, NULL, hInstance, NULL
mov h_window,eax
INVOKE ShowWindow, h_window, SW_SHOW
INVOKE UpdateWindow, h_window
; ERSTELLE BUTTON
invoke CreateWindowExA, NULL, ADDR btnClass, NULL, WS_CHILD or WS_VISIBLE, 150, 150, 150, 150, h_window, ebx, hInstance, NULL
mov h_button, eax
invoke GetClientRect, h_button, ADDR(CoordRect)
;cmp CoordRect.bottom,0 --> Richtig!
cmp CoordRect.left,0 ;--> why NULL???
je @exit_program
@infinite_loop:
INVOKE GetMessageA, ADDR msg, NULL, 0, 0
; falls Benutzer Fenster schließt
cmp eax, 0
je @exit_program
INVOKE TranslateMessage, ADDR msg
INVOKE DispatchMessageA, ADDR msg
jmp @infinite_loop
@exit_program:
invoke ExitProcess, 0
Window ENDP
EVENTS PROC hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
invoke DefWindowProc,hWnd,uMsg,wParam,lParam
ret
EVENTS ENDP
END START