--> Disable or Hide Close Button In Form Delphi | Delphi Tips Trick

For Newbie

Tuesday, 15 November 2011

Disable or Hide Close Button In Form Delphi

| Tuesday, 15 November 2011

Prevents the user to close the form by clicking the close button.

Function declaration:
NoCloser procedure (NamaForm: TForm);
var
   hSisMenu, MCnt: integer;
begin
   hSisMenu: = GetSystemMenu (NamaForm.Handle, False);
   mCnt: = GetMenuItemCount (hSisMenu);
   RemoveMenu (hSisMenu, mCnt - 1, MF_BYPOSITION Or MF_REMOVE);
   DrawMenuBar (NamaForm.Handle);
end;

Use this function when the form OnCreate event or onShowContoh implementation:
TForm1.onCreate procedure (Sender: TObject);
begin
   NoCloser (Form1);
end;

Related Posts

No comments: