Win32


3. - 4


extrn ExitProcess :ptExitProcess

 

UDataSeg

hInst dd ?

hWnd dd ?

 

IFNDEF VER1

hMenu dd ?

ENDIF

 

 

DataSeg

msg msgStruc <>

classTitle db 'Menu demo', 0

wndTitle db 'Demo program', 0

msg_open_txt db 'You selected open', 0

msg_open_tlt db 'Open box', 0

msg_save_txt db 'You selected save', 0

msg_save_tlt db 'Save box', 0

 

CodeSeg

Start: call GetModuleHandleA, 0 ; ,

mov [hInst],eax

 

sub esp,SIZE WndClassEx ;

 

mov [(WndClassEx esp).cbSize],SIZE WndClassEx

mov [(WndClassEx esp).style],CS_HREDRAW or CS_VREDRAW

mov [(WndClassEx esp).lpfnWndProc],offset WndProc

mov [(WndClassEx esp).cbWndExtra],0

mov [(WndClassEx esp).cbClsExtra],0

mov [(WndClassEx esp).hInstance],eax

call LoadIconA, 0, IDI_APPLICATION

mov [(WndClassEx esp).hIcon],eax

call LoadCursorA, 0, IDC_ARROW

mov [(WndClassEx esp).hCursor],eax

mov [(WndClassEx esp).hbrBackground],COLOR_WINDOW

IFDEF VER1

mov [(WndClassEx esp).lpszMenuName],MyMenu

ELSE

mov [(WndClassEx esp).lpszMenuName],0

ENDIF

mov [(WndClassEx esp).lpszClassName],offset classTitle

mov [(WndClassEx esp).hIconSm],0

call RegisterClassExA, esp ;

 

add esp,SIZE WndClassEx ;

;

IFNDEF VER2

call CreateWindowExA, WS_EX_OVERLAPPEDWINDOW,

\ extended window style

offset classTitle, \ pointer to registered class name

offset wndTitle,\ pointer to window name

WS_OVERLAPPEDWINDOW, \ window style