My window close plugin already hooks into the agk window callback so I added a few lines to set the MINMAXINFO structure
// Resizing Window
WC.SetMinTrackSize(300, 300)
WC.SetMaxTrackSize(900, 700)
Example: (plugin attached)
// Project: WindowClose
// Created: 2021-04-17
#import_plugin WindowClose as WC
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "WindowClose" )
SetWindowSize( 1024, 768, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
SetVirtualResolution( 1024, 768 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 30, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts
// register the window with the plugin, sets user callback etc
agk_hwnd = WC.Register("WindowClose")
// Resizing Window
WC.SetMinTrackSize(300, 300)
WC.SetMaxTrackSize(900, 700)
// Maximized Window
// not sure why one would want to override the max window size and position
// but it was there in the structure so I exposed it
// WC.SetMaxSize(300, 300)
// WC.SetMaxPosition(100, 100)
close_count = 1
do
// did the user try to close the window?
if WC.GetClose()
// close the window or
WC.Close(agk_hwnd)
// mimic some function to check for EG: save files before closing
message("Close attempt: "+Str(close_count))
// on 3rd attempt we close the window (for test)
if close_count = 3
close_count=1
WC.Close(agk_hwnd)
endif
inc close_count, 1
endif
Print( agk_hwnd )
Sync()
loop