Just stick this somewhere between your OpenWindow code and main event loop.
Edited on 20 Sep 2002 to do it the "proper" way.

Code: Select all
r=GetMenuItemCount_(GetSystemMenu_(WindowID(),#FALSE)) ; Get number of menu items.
RemoveMenu_(GetSystemMenu_(WindowID(),0),r-1,#MF_BYPOSITION) ; Disable "X" button.
RemoveMenu_(GetSystemMenu_(WindowID(),0),r-2,#MF_BYPOSITION) ; Remove separator.
DrawMenuBar_(WindowID()) ; Redraw the window's menu bar to reflect the changes.
Edited again on 21 Jan 2006 to include the keyword: close.