在系统菜单中实现加入新菜单功能
源代码在线查看: dy219.pas
unit dy219;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
procedure sysmenu(var msg: twmmenuselect);message wm_syscommand;
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var
i: integer;
begin
i := getsystemmenu(handle,false);
appendmenu(i,mf_separator,0,nil);
appendmenu(i,mf_string,100,'我的菜单(&E)');
end;
procedure TForm1.sysmenu(var msg: twmmenuselect);
begin
if msg.IDItem = 100 then
showmessage('您选择了自己添加的菜单!')
else
inherited;
end;
end.