For Newbie

Tuesday, 15 November 2011

Disable or Hide Close Button In Form Delphi


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;

Share on Facebook
Share on Twitter
Share on Google+

Related : Disable or Hide Close Button In Form Delphi