11-28-2022, 01:52 PM
You've taken too many options out of your window flags...
You've got to have a border of some sort where the user can grab to drag and resize... I've did this before, and not had the gap up top where the window title is missing, but I'm not certain now which flag that was that needed toggling.
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
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
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
You've got to have a border of some sort where the user can grab to drag and resize... I've did this before, and not had the gap up top where the window title is missing, but I'm not certain now which flag that was that needed toggling.