unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
procedure WMSysCommand(var Msg: TMessage); message WM_SYSCOMMAND;
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
const
ID_NEWLINE = WM_USER + 4;
ID_ShowMS = WM_USER + 5;
procedure TForm1.FormCreate(Sender: TObject);
var
SysMenu: THandle;
begin
SysMenu := GetSystemMenu(Handle, False);
InsertMenu(SysMenu, 100, MF_SEPARATOR, ID_NEWLINE, nil);
InsertMenu(SysMenu, 100, MF_BYPOSITION, ID_ShowMS, 'Show MS');
end;
procedure TForm1.WMSysCommand;
begin
case Msg.wParam of
ID_ShowMS:
MessageBox(Handle, 'Hi :)', '', MB_OK or MB_ICONINFORMATION);
end;
inherited;
end;
end.