11-28-2022, 10:29 PM
@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_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
WS_CHILD = &H40000000
Do
winstyle& = GetWindowLongA&(hWnd, GWL_STYLE)
Loop Until winstyle&
Do
a& = SetWindowLongA&(hWnd, GWL_STYLE, winstyle& And WS_VISIBLE Or WS_SIZEBOX Or WS_CHILD)
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 1, 1: Print " Try to resize. Pete can't, but Steve can! 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