procedure user_sysmenu(var msg: twmmenuselect); message wm_syscommand;
procedure TForm1.User_Sysmenu(var msg: TWMMENUSELECT);
begin
if Msg.Iditem = 100 then
ShowMessage('响应系统菜单!')
else
inherited; {作缺省处理,必须调用这一过程}
end;
procedure TForm1.FormCreate(Sender: TObject);
var
hMenu: integer;
begin
hMenu := GetSystemMenu(Handle, False); {获取系统菜单句柄}
AppendMenu(hmenu, MF_SEPARATOR, 0, nil);
AppendMenu(hmenu, MF_STRING, 100, '加入系统菜单'); {加入用户菜单}
end;