While working on the form testing portion I came up with the following.
It allows you to open a window (can also be adapted to work with a dialog) and close the window by clicking anywhere on your screen.
The left-click can be anywhere on the window itself(including any of it's controls) or anywhere outside the window.
Somebody might find a use/need for it.
DECLARE "user32.dll",SetCapture(hwnd:INT),INT
DECLARE "user32.dll",ReleaseCapture(),INT
Const WM_NCHITTEST=0x84
CONST HTCLIENT = 1
CONST WM_KILLFOCUS = 8
ENUM win_const
win_BUTTON1 = 100
ENDENUM
WINDOW win
OpenWindow win,0,0,400,300,@SIZE|@MINBOX|@MAXBOX|@NOCAPTION|@SYSMENU,0,"Form1",&win_handler
CONTROL win,@SysButton,"Button 1",98,153,60,25,0,win_BUTTON1
SetCapture(win.hwnd)
WAITUNTIL ISWINDOWCLOSED(win)
END
SUB win_handler(), INT
SELECT @MESSAGE
CASE @IDCREATE
CENTERWINDOW win
CASE @IDCONTROL
SELECT @CONTROLID
CASE win_BUTTON1
IF @NOTIFYCODE = 0
ENDIF
ENDSELECT
case WM_NCHITTEST
return HTCLIENT
CASE @IDCLOSEWINDOW
CASE& @IDLBUTTONUP
case& WM_KILLFOCUS
ReleaseCapture()
CLOSEWINDOW win
ENDSELECT
RETURN 0
END SUB