=====Disabling the close button===== //by Richard Russell, August 2008//\\ \\ It is easy enough to make the close button (in the top-right corner of the window) ineffective, by executing the following statement: ON CLOSE RETURN This results in the button being ignored. However there may be occasions when you actually want to disable the close button, and indicate that it is disabled by it being 'greyed out'. You can do that as follows: SC_CLOSE = &F060 SYS "GetSystemMenu", @hwnd%, 0 TO sysmenu% SYS "EnableMenuItem", sysmenu%, SC_CLOSE, 1 When you want to enable the button again execute the following code: SC_CLOSE = &F060 SYS "GetSystemMenu", @hwnd%, 0 TO sysmenu% SYS "EnableMenuItem", sysmenu%, SC_CLOSE, 0 Note that whereas "ON CLOSE RETURN" also causes **Alt+F4** to be ignored, disabling the close button doesn't, and this alternative means of closing the window remains available.