Default
Google

How can I remove items from the system menu?

Applies To: C++Builder 1 or higher
Category: Knowledge Base

 
 1.
  Start a new project using File | New Application.
 
 2.
  Add a Button. Edit its OnClick event:
 
void __fastcall TForm1::Button1Click(TObject *Sender)
{
    HMENU menu = GetSystemMenu(Handle, false);
    if(menu)
    {
        RemoveMenu(menu, 1, MF_BYPOSITION);
        RemoveMenu(menu, 0, MF_BYPOSITION);
    }
}
 
This code removes the first two items (Restore and Move) from the system menu. Pay attention: you must start from the biggest value (in this case 1) to smallest one.

C++Builder Developer's Network
Copyright © Yoto Yotov



Acquiring image from ProHosting Banner Exchange