Deleting an item from the system menu

//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
    HMENU hSystemMenu;

    hSystemMenu = GetSystemMenu(Handle, FALSE);
    DeleteMenu(hSystemMenu, SC_SIZE, MF_BYCOMMAND);
    DeleteMenu(hSystemMenu, SC_MOVE, MF_BYCOMMAND);
}
//---------------------------------------------------------------------------

Restricting an Edit control to receive only digits:

//---------------------------------------------------------------------------
void __fastcall TForm1::Edit1KeyPress(TObject *Sender, char &Key)
{
    if ((Key < '0') || (Key > '9'))
    {
        Key = '\0' ;
    }
}
//---------------------------------------------------------------------------

Moving a form from its body

 

Home