11-28-2022, 12:43 PM
$RESIZE requires the Windows title bar is present. This demo will show how $RESIZE:ON is suspended when we start the program without a title bar using Win32 API commands.
Pete
Code: (Select All)
$RESIZE:ON
DECLARE DYNAMIC LIBRARY "user32"
FUNCTION GetWindowLongA& (BYVAL hwnd AS LONG, BYVAL nIndex AS LONG)
FUNCTION SetWindowLongA& (BYVAL hwnd AS LONG, BYVAL nIndex AS LONG, BYVAL dwNewLong AS LONG)
FUNCTION SetWindowPos& (BYVAL hwnd AS LONG, BYVAL hWndInsertAfter AS LONG, BYVAL x AS LONG, BYVAL y AS LONG, BYVAL cx AS LONG, BYVAL cy AS LONG, BYVAL wFlags AS LONG)
END DECLARE
DIM hWnd AS LONG
hWnd = _WINDOWHANDLE
_DELAY .1
GWL_STYLE = -16
ws_border = &H800000
WS_VISIBLE = &H10000000
DO
winstyle& = GetWindowLongA&(hWnd, GWL_STYLE)
LOOP UNTIL winstyle&
DO
a& = SetWindowLongA&(hWnd, GWL_STYLE, winstyle& AND WS_VISIBLE)
LOOP UNTIL a&
a& = SetWindowPos&(hWnd&, 0, 0, 0, 0, 0, 39) ' Required to allow printing where title bar used to be.
_DELAY .1
CLS: LOCATE 2, 1: PRINT " Try to resize. You can't. Now press a key to restore title bar and retry!"
DO
_LIMIT 30
b$ = INKEY$
IF LEN(b$) THEN
IF b$ = CHR$(27) THEN END
' Restore title bar.
a& = SetWindowLongA&(hWnd, GWL_STYLE, winstyle& OR ws_border)
a& = SetWindowPos&(hWnd&, 0, 0, 0, 0, 0, 39)
CLS: _DELAY .75
LOCATE 2, 1: PRINT " Okay. Now you can resize the window with a mouse drag."
END IF
LOOP
Pete