本文讲解的是为自身程序的任务栏右键菜单里添加自己定义的菜单的方法:
delphi添加任务栏右键菜单
procedure TForm1.FormCreate(Sender: TObject);
var
Mnu: HMenu;
begin
Mnu := GetSystemMenu(Application.Handle, False);
AppendMenu(Mnu, MF_SEPARATOR, 0, nil);
AppendMenu(Mnu, MF_STRING, WM_ABOUT, pchar('关于我们..^^'));
Application.OnMessage := OnAppMessage;
end;
procedure TForm1.OnAppMessage(var Msg: TMsg; Var Handled: Boolean);
begin
if Msg.message = WM_SYSCOMMAND then
begin
if Msg.wParam = WM_ABOUT then
begin
form2.Show;
end;
end;
end;