关于系统菜单的问题(50分)

  • 主题发起人 主题发起人 4ever
  • 开始时间 开始时间
4

4ever

Unregistered / Unconfirmed
GUEST, unregistred user!
请问:如何获取应用程序 ICON 对应的系统菜单?<br>&nbsp; &nbsp; &nbsp; 如何向其中加入新的菜单项?
 
试试这段代码<br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br>menuh:HMENU;<br>begin<br>&nbsp; menuh:=getsystemmenu(findwindow('Tform1','Form1'),False);<br>&nbsp; Appendmenu(menuh,MF_MENUBREAK,100,'试验');<br>end;<br>
 
和我联系吧,我有例子,<br>loopy@netease.com
 
如何在任务栏的图标上添加、响应系统菜单?
 
请使用这段代码.<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br>&nbsp; SysMenu: HMENU;<br>&nbsp; MenuItemInfo: TMenuItemInfo;<br>&nbsp; MenuName: string;<br>&nbsp; CommandPool: TBits;<br>begin<br>&nbsp; MenuName:='Test';<br>&nbsp; CommandPool := TBits.Create;<br>&nbsp; SysMenu := GetSystemMenu(Handle, False);<br>&nbsp; DeleteMenu(SysMenu, SC_TASKLIST, MF_BYCOMMAND);<br>&nbsp; DeleteMenu(SysMenu, 7, MF_BYPOSITION);<br>&nbsp; DeleteMenu(SysMenu, 5, MF_BYPOSITION);<br>&nbsp; DeleteMenu(SysMenu, SC_MAXIMIZE, MF_BYCOMMAND);<br>&nbsp; DeleteMenu(SysMenu, SC_MINIMIZE, MF_BYCOMMAND);<br>&nbsp; DeleteMenu(SysMenu, SC_SIZE, MF_BYCOMMAND);<br>&nbsp; DeleteMenu(SysMenu, SC_RESTORE, MF_BYCOMMAND);<br>&nbsp; MenuItemInfo.cbSize := 44; // Required for Windows 95<br>&nbsp; MenuItemInfo.fMask := MIIM_CHECKMARKS or MIIM_DATA or MIIM_ID or<br>&nbsp; &nbsp; MIIM_STATE or MIIM_SUBMENU or MIIM_TYPE;<br>&nbsp; MenuItemInfo.fType := MFT_STRING;<br>&nbsp; MenuItemInfo.fState := MFS_UNCHECKED or MFS_ENABLED;<br>&nbsp; MenuItemInfo.wID := CommandPool.OpenBit;<br>&nbsp; MenuItemInfo.hSubMenu := 0;<br>&nbsp; MenuItemInfo.hbmpChecked := 0;<br>&nbsp; MenuItemInfo.hbmpUnchecked := 0;<br>&nbsp; MenuItemInfo.dwTypeData := PChar(MenuName);<br>&nbsp; InsertMenuItem(SysMenu, DWORD(-1), True, MenuItemInfo);<br>&nbsp; CommandPool.Free;<br>end;<br>
 
多人接受答案了。
 
后退
顶部