Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Manually resizing with $RESIZE:ON
#6
That restored the ability to resize the window, but we now have another prime contestant for the 3rd Annual Bud Tugly Award.

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_SIZEBOX = &H40000 ' Same as WS_THICKBORDER = &H40000
WS_POPUP = &H4800000 ' Can be used to make a razor thin border but is not resizable.
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 OR WS_SIZEBOX)
LOOP UNTIL a&
a& = SetWindowPos&(hWnd&, 0, 0, 0, 0, 0, 39) ' Required to allow printing where title bar used to be.
_DELAY .1

PALETTE 7, 63
COLOR 0, 7
VIEW PRINT: 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

Interesting that the thickbrder properties do not completely vanish when the title bar style is brought back. See black border on right and bottom.

The only solution to the ugly divided color situation might be to figure out the method Windows goes about to paint the window background and see if painting the window background white would completely cover the black space.

Pete
Shoot first and shoot people who ask questions, later.
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)