What is the first *Win16* source code to ever be posted to FoRK?

Joe Barrera (joebar@MICROSOFT.com)
Wed, 6 May 1998 18:21:18 -0700


It's true, the FoRK FAQ does tell us what the first code posted to FoRK was.
But, although that was code to be compiled under Windows, it was only a
console mode app. I hereby present the first Win16 code ever posted to FoRK.
As an added bonus, I selected the computer language mostly likely to cause
(or at least be blamed for) the downfall of civilization.

- 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.