Free Web Hosting Provider - Web Hosting - E-commerce - High Speed Internet - Free Web Page
Search the Web

 
Deleting a menu item from a Form's System Menu 

You can grab a handle to the system (window) menu of a Form via the GetSystemMenu API function.  With this handle, you can use API menu manipulation functions such as DeleteMenu, to alter the system menu.  Here's an example to remove the "Move" option from the system menu.  Have a look in the WinAPI help file under "DeleteMenu" for more information.

KEYWORDS: DeleteMenu, GetSystemMenu, HMENU 


 

//---------------------------------------------------------------------------
void __fastcall TForm2::FormShow(TObject *Sender) 

    HMENU hMenu = GetSystemMenu(Handle, FALSE); 
    DeleteMenu(hMenu, SC_MOVE, MF_BYCOMMAND); 
}