本例效果图:


unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
    procedure SysMenu(var msg: TWMMenuSelect); message WM_SYSCOMMAND;
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
var
  hm: HMENU;
begin
  hm := GetSystemMenu(Handle, False);
  AppendMenu(hm, MFT_SEPARATOR, 0, nil);
  AppendMenu(hm, MFT_STRING, 100, '新菜单项');
end;

procedure TForm1.SysMenu(var msg: TWMMenuSelect);
begin
  if msg.IDItem = 100 then
    ShowMessage('新菜单项')
  else inherited;
end;

end.

posted on 2008-04-28 21:43  万一  阅读(3136)  评论(3编辑  收藏  举报