Function MainWindow(width,height,style)
=======================================
'
sys a,b,c,hWnd
WNDCLASS wc
MSG wm
'
inst=GetModuleHandle 0
'
with wc. '
style=CS_HREDRAW or CS_VREDRAW
lpfnWndProc = @wndproc
cbClsExtra = 0
cbWndExtra = 0
hInstance = inst
hIcon = LoadIcon 0, IDI_APPLICATION
hCursor = LoadCursor 0,IDC_ARROW
hbrBackground = GetStockObject WHITE_BRUSH '
lpszMenuName = 0
lpszClassName = strptr "wins"
end with
if not RegisterClass @wc
MessageBox 0,`Registration failed`,`Problem`,MB_ICONERROR
exit function
end if
'Create the main window.
hwnd = CreateWindowEx(
0, 'no extended styles
"wins", 'class name
"Main Window", 'window name
style, '
CW_USEDEFAULT, 'default horizontal position
CW_USEDEFAULT, 'default vertical position
width, 'default width
height, 'default height
null, 'no parent or owner window
null, 'class menu used
inst, 'instance handle
null); 'no window creation data
if not hWnd then
MessageBox 0,`Unable to create window`,`problem`,MB_ICONERROR
exit function
end if
'
ShowWindow hWnd,SW_NORMAL
UpdateWindow hWnd
'
'MESSAGE LOOP
'============
'
sys bRet
'
while bRet := GetMessage @wm, 0, 0, 0
if bRet == -1 then
'show an error message?
else
m=wm.message
select m
'
case WM_LBUTTONDBLCLK
=====================
'
SendMessage hwnd,WM_COMMAND,1100-0x200+m, 0
'
case WM_KEYDOWN
===============
'
m=wm.wparam
select m
case VK_RETURN
for i=1 to nchw
if wm.hwnd=hchw(i)
SendMessage hwnd,WM_COMMAND,2000+VK_RETURN,0
if i>1 then continue while 'first window is editor
end if
next
case VK_F1 to VK_F10
SendMessage hwnd,WM_COMMAND,1001+m-VK_F1, 0
case "A" to "Z"
if CtrlKey
SendMessage hwnd,WM_COMMAND,2000+m, 0
if m=65 or m=70 or m=71 then continue while
end if
case VK_ESCAPE
SendMessage hwnd,WM_COMMAND,2200+VK_ESCAPE, 0
Continue do
end select
'
end select
'
TranslateMessage @wm
DispatchMessage @wm
end if
wend
'
end function ; end of WinMain