Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Prevent Maximize
#2
(05-12-2022, 10:23 AM)crumpets Wrote: Is there any way in QB64 that you can prevent a window from maximizing?

Try the following:

Code: (Select All)
Option _Explicit
'=============================
'a_disable_maximize_button.bas
'=============================

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)
End Declare

Const GWL_STYLE = -16
Const WS_MAXIMIZEBOX = &H00010000 'maximize button
Const WS_MINIMIZEBOX = &H00020000 'minimize button


Dim hwnd, winstyle, a As Long

hwnd = _WindowHandle
winstyle = GetWindowLongA&(hwnd, GWL_STYLE) 'Get current style
a = SetWindowLongA&(hwnd, GWL_STYLE, winstyle And Not WS_MAXIMIZEBOX) '
a = SetWindowLongA&(hwnd, GWL_STYLE, winstyle And Not WS_MINIMIZEBOX) '


_Title "Disable maximize button"
Print "The end"
Reply


Messages In This Thread
Prevent Maximize - by crumpets - 05-12-2022, 10:23 AM
RE: Prevent Maximize - by mpgcan - 05-12-2022, 11:38 AM
RE: Prevent Maximize - by crumpets - 05-12-2022, 11:58 AM
RE: Prevent Maximize - by James D Jarvis - 05-12-2022, 12:17 PM



Users browsing this thread: 1 Guest(s)