简体   繁体   English

如何使用vc ++获取菜单项文本?

[英]how to get menu item text using vc++?

My problem is "how to know which menu item is clicked in visual studio 2005". 我的问题是“如何知道在Visual Studio 2005中单击了哪个菜单项”。 i wrote some code using hook for monitoring WM_MENUSELECT..it is working fine for notepad,visual c++6.0 applications but when i use this code for VS-2005 it is not woking(these type of msgs are not generating when i click menuitem in VS2005).. 我使用钩子编写了一些代码来监视WM_MENUSELECT ..它对于记事本,可视c ++ 6.0应用程序正常工作,但是当我将此代码用于VS-2005时却无法正常工作(当我单击menuitem时,不会生成这些类型的味精在VS2005中)。

is there any other way to achive this... 还有其他方法可以实现这一目标...

please help me on this..i am really getting irritating becoz i am struggling from last one month... 请帮助我。.我真的很烦人,因为我上个月一直在挣扎...

any help is greatly appreciated... 任何帮助是极大的赞赏...

Any time you assume anything about how other people's software is implemented, you run the risk that they did something unusual or otherwise contrary to your expectations. 任何时候假设您对他人软件的实施方式有任何看法,都将冒着他人做出异常或与您的期望相反的事情的风险。 There is no perfect solution here. 这里没有完美的解决方案。

Having said that, you could try hooking WM_COMMAND messages instead of WM_MENUSELECT. 话虽如此,您可以尝试挂钩WM_COMMAND消息,而不是WM_MENUSELECT。 That's more likely to be used by alternative toolbar/menu implementations. 替代性工具栏/菜单实现更可能使用该方法。

WM_MENUSELECT is a message from a Windows component. WM_MENUSELECT是Windows组件发出的消息。 The same message is used, whether you're using C, C++, Delphi or any other language. 无论您使用的是C,C ++,Delphi还是任何其他语言,都会使用相同的消息。 A trivial difference like VC++6 and VC++8 won't matter. 像VC ++ 6和VC ++ 8这样的琐碎差异并不重要。 XP or Vista could matter, but I'd doubt it. XP或Vista可能很重要,但我对此表示怀疑。

Now, it's possible that the actual cause of your difference is a different MFC version or something like that, but without code that would be speculating. 现在,造成差异的实际原因很可能是不同的MFC版本或类似的版本,但是没有可以推测的代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM