Another way...
; ------------------------------------------------ ; Disable windowed display's close button... ; ------------------------------------------------ ; ------------------------------------------------ ; ADD TO USER32.decls... ; ------------------------------------------------ ; GetSystemMenu% (window, flags) ; EnableMenuItem% (menu, item, flags) ; ------------------------------------------------ ; Parameters: Window handle, True/False... Function DisableWindowClose (window, disable) EnableMenuItem (GetSystemMenu (window, 0), $F060, disable) End Function ; Open windowed display... Graphics3D 640, 480, 0, 2 ; Get window handle immediately... window = GetActiveWindow () ; Turn off Close menu item/gadget... DisableWindowClose (window, True) ; Set variable for toggle use below... disable = True Repeat Cls ; Switch between enabled/disabled when Space is hit... If KeyHit (57) disable = 1 - disable DisableWindowClose (window, disable) EndIf Text 20, 20, "La la la (SPACE to toggle)..." Flip Until KeyHit (1) End