现在的位置: 首页 > 综合 > 正文

如何在系统菜单中添加一个自己的菜单项

2013年03月31日 ⁄ 综合 ⁄ 共 3574字 ⁄ 字号 评论关闭

CSDN地址: http://topic.csdn.net/u/20080722/18/8517e419-7788-4d1c-9029-7a806f5da46c.html

全文:

如题,目前我要做的就是在系统菜单中添加一个自己的菜单项(比如是“联系人”这个界面,右下脚的“菜单”),并响应自己要实现的功能。分不够的我可以另外开帖给你加上。谢谢~~~~~

回复次数:33

 

  • ciahi用户头像
  • ciahi
  • (爪哇乞丐)
  • 等 级:
#1楼 得分:0
回复于:2008-07-22 20:41:53

AppendMenu不行吗?

#2楼 得分:0
回复于:2008-07-22 22:15:23

谢谢楼上的,不过应该没有这么简单吧,我指的菜单是系统对话框,而不是自己程序的对话框,比如系统有个对话框叫"联系人",该窗口有它自己的菜单项.目前大概方向是修改注册表,但是一直没发现相关的主键,请有做过的达人指教。

#3楼 得分:50
回复于:2008-07-22 23:54:46

下面这篇文章里包括了所有你要的东西 

http://msdn.microsoft.com/en-us/library/bb158572.aspx

当弹出菜单时会发送WM_INITMENUPOPUP消息,拿到菜单句柄就可以添加删除

#4楼 得分:0
回复于:2008-07-23 08:49:38

谢谢楼上的,可以留下msn吗

#5楼 得分:0
回复于:2008-07-23 08:59:20

SDK例子里有ctxmenu,实质是一个com组件,添加到注册表里联系人启动的时候调用com组件

#6楼 得分:0
回复于:2008-07-23 09:20:02

不是很明白楼上的意思,这个com组件是系统自带吗?
具体怎么实现的呢

#7楼 得分:0
回复于:2008-07-23 16:28:13

有些进展了,不过有个问题,发现在QueryContextMenu这函数中pIdo->GetData(&fe, &sm)这个函数失败了,GetLastError居然是120(这个系统不支持该功能).

#8楼 得分:0
回复于:2008-07-23 19:51:36

自己顶

  • wuminxss用户头像
  • wuminxss
  • (英俊走一回)
  • 等 级:
#9楼 得分:0
回复于:2008-07-23 21:57:34

引用 3 楼 btsy2000 的回复:

下面这篇文章里包括了所有你要的东西
http://msdn.microsoft.com/en-us/library/bb158572.aspx

当弹出菜单时会发送WM_INITMENUPOPUP消息,拿到菜单句柄就可以添加删除

如果我要在Start->Messaging界面的右键菜单加一个菜单项,与之相关的class和Context是哪个?
微软有公布吗?

#10楼 得分:0
回复于:2008-07-24 09:20:56

wuminxss ,应该是 context:Inbox,class就看具体哪个界面了

  • hnhuibo用户头像
  • hnhuibo
  • (飞扬洞庭)
  • 等 级:
#11楼 得分:0
回复于:2008-07-24 09:33:35

d

#12楼 得分:0
回复于:2008-07-24 10:57:44

在添加菜单项时,为什么要加DelayLoad这个dword键值呢?如果设置为1,菜单响应时,不会调用到
自己定义的COM组件的QueryContextMenu函数,而且菜单直接显示的菜单项名称是注册表中默认的字串名。如果设置为0,在COM组件的
QueryContextMenu函数里,有个pIdo->GetData(&fe,
&sm)函数,会失败,有人知道为什么吗?是不是我注册表中少了什么项?

#13楼 得分:50
回复于:2008-07-24 11:36:53

要使用IContextMenu这个接口。。。
可以参照一下这个例子,它在TMAIL里右下角的menu添加了两条选项
/Program Files/Windows Mobile 6 SDK/Samples/Common/CPP/Win32/InboxMenuExtensibility/
Contacts也是支持这个接口的

#14楼 得分:0
回复于:2008-07-24 16:35:54

谢谢楼上.
还有个问题,在QueryContextMenu时如果同时insertmenu 2个菜单项,
InsertMenu ( hmenu, indexMenu, MF_BYPOSITION|MF_STRING , idCmdFirst, _T("Menu Test 1") ); 
InsertMenu ( hmenu, indexMenu, MF_BYPOSITION|MF_STRING , idCmdFirst, _T("Menu Test 2") ); 
在InvokeCommand中如何区分菜单,如何区分这两个菜单项?LPCMINVOKECOMMANDINFO pici->lpVerb是一个很大的数,并不是 0, 或者1

#15楼 得分:0
回复于:2008-07-24 16:51:51

lpVerb 
A 32-bit value containing the command
being invoked, expressed as either a string (for programmatic
invocation), or a menu-identifier offset (for user invocation). 

When
containing a string, the HIWORD is non-zero. In this case, lpVerb
contains the address of a null-terminated string specifying the
language-independent name of the command. The system provides
predefined constant values for some command strings. For details, see
the table below. 

When containing a menu-identifier offset,
the HIWORD is zero. In this case, lpVerb contains a menu-identifier
offset of the command in the LOWORD. The shell specifies this value
using MAKEINTRESOURCE(idOffset). For details, see "User Interface
Services" in the Windows CE .NET 4.2 documentation. 

#16楼 得分:0
回复于:2008-07-24 16:54:55

http://msdn.microsoft.com/en-us/library/bb773215(VS.85).aspx

#17楼 得分:0
回复于:2008-07-24 16:58:47

(LPCTSTR)lpici->lpVerb
是你menu上显示的字符串的地址

#18楼 得分:0
回复于:2008-07-24 17:32:59

抱歉!评论已关闭.