But I also have to be able to switch the resizing off and on, because sometimes I don't want the user to be able to resize it.
And the thing is... I don't know how to do this!

Code: Select all
Procedure WndProc(WindowID, Message, wParam, lParam)
Result = #PB_ProcessPureBasicEvents
*pMinMax.MINMAXINFO
If Message = #WM_GETMINMAXINFO
*pMinMax = lParam
*pMinMax\ptMaxTrackSize\x = 640+2*GetSystemMetrics_(#SM_CXSIZEFRAME)
*pMinMax\ptMinTrackSize\x = 640+2*GetSystemMetrics_(#SM_CXSIZEFRAME)
Result = 0
EndIf
ProcedureReturn Result
EndProcedure
OpenWindow(0,0,0,640,500,"",#PB_Window_SystemMenu|#PB_Window_SizeGadget)
SetWindowCallback(@WndProc())
Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
Code: Select all
Global MaxScale.l
;
Procedure WndProc(WindowID, Message, wParam, lParam)
Result = #PB_ProcessPureBasicEvents
*pMinMax.MINMAXINFO
If Message = #WM_GETMINMAXINFO
*pMinMax = lParam
*pMinMax\ptMaxTrackSize\X = MaxScale
*pMinMax\ptMinTrackSize\X = MaxScale
Result = 0
EndIf
ProcedureReturn Result
EndProcedure
;
WinWidth.w = 640;
WinHeight.w = 480;
OpenWindow(0,0,0,WinWidth,WinHeight,"",#pb_window_systemmenu|#PB_Window_SizeGadget)
MaxScale =WinWidth+2*GetSystemMetrics_(#SM_CXSIZEFRAME)
SetWindowCallback(@WndProc())
;
Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
Code: Select all
Procedure ToggleSizeWindow(window.l)
Protected hWnd.l = WindowID(window)
Protected style.l = GetWindowLong_(hWnd, #GWL_STYLE)
If (style&#WS_SIZEBOX)
SetWindowLong_(hWnd, #GWL_STYLE, style&~#WS_SIZEBOX)
Else
SetWindowLong_(hWnd, #GWL_STYLE, style|#WS_SIZEBOX)
EndIf
SetWindowPos_(hWnd, 0, 0, 0, 0, 0, #SWP_NOMOVE|#SWP_NOSIZE|#SWP_NOZORDER|#SWP_FRAMECHANGED)
EndProcedure
Code: Select all
Global MaxScale.l
;
Procedure WndProc(WindowID, Message, wParam, lParam)
Result = #PB_ProcessPureBasicEvents
*pMinMax.MINMAXINFO
If Message = #WM_GETMINMAXINFO And GetGadgetState(1)
*pMinMax = lParam
*pMinMax\ptMaxTrackSize\X = MaxScale
*pMinMax\ptMinTrackSize\X = MaxScale
Result = 0
ElseIf message = #WM_SIZE
MaxScale=WindowWidth(0)+2*GetSystemMetrics_(#SM_CXSIZEFRAME)
EndIf
ProcedureReturn Result
EndProcedure
;
WinWidth.w = 640;
WinHeight.w = 480;
OpenWindow(0,0,0,WinWidth,WinHeight,"",#PB_Window_SystemMenu|#PB_Window_SizeGadget)
CreateGadgetList(WindowID(0))
CheckBoxGadget(1,10,10,20,20,"")
TextGadget(2,40,10,200,20,"Check to prohibit horizontal sizing.")
MaxScale =WinWidth+2*GetSystemMetrics_(#SM_CXSIZEFRAME)
SetWindowCallback(@WndProc())
;
Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow