Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Prevent Maximize
#1
Is there any way in QB64 that you can prevent a window from maximizing?
Reply
#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
#3
Thank you. This is an excellent solution, but only works on Windows. I suppose doing it in macOS and Linux is not possible?
Reply
#4
(05-12-2022, 10:23 AM)crumpets Wrote: Is there any way in QB64 that you can prevent a window from maximizing?


Code: (Select All)
_AllowFullScreen _Off 

This will do it.

or maybe this.
Code: (Select All)
$Resize:Off
_AllowFullScreen _Off
Reply




Users browsing this thread: 1 Guest(s)