type ArrSMId:Array [0..4] of Integer=(100,101,102,103,104); //自定义系统菜单ID ArrItemName:Array[0..3] of String=('正常显示','装饰滚动条', '装饰边框','装饰滚动条和边框'); ........ var i:integer; begin for i:=high(ArrItemname) downto 0 do InsertMenu(GetSystemMenu(handle,false), MF_STRING,MF_BYPOSITION,ArrSmId[i], Pchar(ArrItemName[i]));..... procedure TForm1.MySysMenuClick(var Msg:TWMSysCommand); begin inherited; { 拦截自定义系统菜单ID } if (Integer(Msg.CmdType)>99) and (Integer(Msg.CmdType)<105) then begin Case Integer(Msg.CmdType) of 100, 101, 102, 103 :SetBmpViewStyle(Integer(msg.CmdType)-100); 104 :ShowAbout('About: '+fCaption,nil); end; end; end;
to net_z():我不是要增加菜单项,只是要实现系统菜单功能 to OysterLQD(沉默者):怎么加代码?怎么识别是选了哪个菜单项?有源代吗吗?
popmenu:hmenu; popids:array of integer; menucount:integer;procedure TForm1.FormCreate(Sender: TObject); var icount:integer; begin popmenu:=getsystemmenu(self.Handle,false); menucount:= getmenuitemcount(popmenu) ; setlength(popids,menucount); for icount:=0 to menucount do begin popids[icount]:=getmenuitemid(popmenu,icount); end; end;procedure tform1.wmcommand(var msg:twmcommand); var icount:integer; begin inherited; if msg.ItemID=popids[0] then showmessage('u press the first item'); end;procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);begin if button=mbright then trackpopupmenuex(popmenu,0,x,y,self.Handle,nil); end;见笑了
ArrSMId:Array [0..4] of Integer=(100,101,102,103,104); //自定义系统菜单ID
ArrItemName:Array[0..3] of String=('正常显示','装饰滚动条',
'装饰边框','装饰滚动条和边框');
........
var
i:integer;
begin
for i:=high(ArrItemname) downto 0 do
InsertMenu(GetSystemMenu(handle,false),
MF_STRING,MF_BYPOSITION,ArrSmId[i],
Pchar(ArrItemName[i]));.....
procedure TForm1.MySysMenuClick(var Msg:TWMSysCommand);
begin
inherited;
{ 拦截自定义系统菜单ID }
if (Integer(Msg.CmdType)>99) and (Integer(Msg.CmdType)<105) then
begin
Case Integer(Msg.CmdType) of
100,
101,
102,
103 :SetBmpViewStyle(Integer(msg.CmdType)-100);
104 :ShowAbout('About: '+fCaption,nil);
end;
end;
end;
to OysterLQD(沉默者):怎么加代码?怎么识别是选了哪个菜单项?有源代吗吗?
popids:array of integer;
menucount:integer;procedure TForm1.FormCreate(Sender: TObject);
var
icount:integer;
begin
popmenu:=getsystemmenu(self.Handle,false);
menucount:= getmenuitemcount(popmenu) ;
setlength(popids,menucount);
for icount:=0 to menucount do
begin
popids[icount]:=getmenuitemid(popmenu,icount);
end;
end;procedure tform1.wmcommand(var msg:twmcommand);
var
icount:integer;
begin
inherited;
if msg.ItemID=popids[0] then
showmessage('u press the first item');
end;procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);begin
if button=mbright then
trackpopupmenuex(popmenu,0,x,y,self.Handle,nil);
end;见笑了
Thanks
太繁了一点
不过没有办法了