本例效果图:
![](https://www.cnblogs.com/images/cnblogs_com/del/129733/o_84281.gif)
![](https://www.cnblogs.com/images/cnblogs_com/del/129733/o_84281.gif)
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.