unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, AppEvnts;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    ApplicationEvents1: TApplicationEvents;
    procedure ApplicationEvents1Message(var Msg: tagMSG; var Handled: Boolean);
    procedure Button2Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  protected
    procedure WMSysCommand(var Message :TWMSysCommand); message WM_SYSCOMMAND;
  end;

const SE_INFO=100;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var uchwyt :THandle;
begin
uchwyt:=Handle; //menu systemowe okna
//uchwyt:=Application.Handle; //menu systemowe aplikacji w pasku zadań

AppendMenu(GetSystemMenu(uchwyt,False),MF_SEPARATOR,0,nil);
AppendMenu(GetSystemMenu(uchwyt,False),MF_STRING,SE_INFO,'O ...');
end;

procedure TForm1.Button2Click(Sender: TObject);
var uchwyt :THandle;
begin
//uchwyt:=Handle; //menu systemowe okna
uchwyt:=Application.Handle; //menu systemowe aplikacji w pasku zadań

AppendMenu(GetSystemMenu(uchwyt,False),MF_SEPARATOR,0,nil);
AppendMenu(GetSystemMenu(uchwyt,False),MF_STRING,SE_INFO,'O ...');
end;

procedure TForm1.WMSysCommand(var Message :TWMSysCommand);
begin
 if Message.CmdType=SE_INFO then
  begin
  Message.Result:=0;
  ShowMessage('Delphi 2005. 303 praktyczne przykłady'+#13+'(c) Jacek Matulewski 2005');
  end
  else inherited;
end;

procedure TForm1.ApplicationEvents1Message(var Msg: tagMSG;
  var Handled: Boolean);
begin
 if (Msg.message=WM_SYSCOMMAND) and (Msg.wParam=SE_INFO) then
  begin
  Handled:=True;
  ShowMessage('Delphi 2005. 303 praktyczne przykłady'+#13+'(c) Jacek Matulewski 2005');
  end
end;

end.
