Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Manually resizing with $RESIZE:ON
#3
$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.

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
Reply


Messages In This Thread
Manually resizing with $RESIZE:ON - by SMcNeill - 07-24-2022, 08:28 PM
RE: Manually resizing with $RESIZE:ON - by Pete - 11-28-2022, 12:43 PM
RE: Manually resizing with $RESIZE:ON - by Dav - 11-28-2022, 04:37 PM
RE: Manually resizing with $RESIZE:ON - by Pete - 11-28-2022, 09:57 PM
RE: Manually resizing with $RESIZE:ON - by Pete - 11-28-2022, 11:42 PM



Users browsing this thread: 1 Guest(s)