- Joe
procedure division WINAPI using by value hInst
by value hPrevInstance
by reference lpszCmdLine
by value nCmdShow.
MyWinMain section.
if hPrevInstance = 0
move 3 to style
set lpfnWndProc to entry "MyWndProc"
move 0 to cbClsExtra
move 0 to cbWndExtra
move hInst to hInstance
call WINAPI "__LoadIcon" using by value 0 size 2
by value h"00007f00" size 4
returning hIcon
call WINAPI "__LoadCursor" using by value 0 size 2
by value h"00007f00" size 4
returning hCursor
call WINAPI "__GetStockObject" using by value 0 size 2
returning hbrBackground
set lpszMenuName to NULL
set lpszClassName to address of MyClassName
call WINAPI '__RegisterClass' using WndClass
returning tmpFlag
if tmpFlag = 0
exit program returning 0
end-if
end-if
call WINAPI "__CreateWindow" using by reference MyClassName
by reference "COBOL & Windows" & x"00"
by value h"00CF0000" size 4
by value h"8000" size 2
by value 0 size 2
by value h"8000" size 2
by value 0 size 2
by value 0 size 2
by value 0 size 2
by value hInst
by value 0 size 4
returning hWindow
call WINAPI "__ShowWindow" using by value hWindow
by value nCmdShow
call WINAPI "__UpdateWindow" using by value hWindow
perform until loop-end
call WINAPI '__GetMessage' using
by reference msg
by value 0 size 2
by value 0 size 2
by value 0 size 2
returning bool
if boolFALSE
set loop-end to true
else
call WINAPI '__TranslateMessage'
using by reference msg
call WINAPI '__DispatchMessage'
using by reference msg
end-if
end-perform
exit program returning msg-wParam
stop run.