禁用Word 2003中的默认按钮
我目前正在尝试禁用 word 2k3 中菜单栏上的一些按钮,但我不知道如何执行此操作,从我在网上找到的内容来看,我似乎需要从 user32.dll 调用函数“EnableMenuItem”但它似乎不起作用。还有其他选择吗?我想禁用复制/粘贴/剪切而不使用宏来拦截调用。
谢谢大家的帮助:)
Gonçalo
I'm currently trying to disable some buttons on the menu bar in word 2k3 but I have no clue on how to do so, from what I can find online it seems that i need to call the function "EnableMenuItem" from the user32.dll but it doesnt seem to work. Are there any other options available? I want to disable copy/paste/cut without the use of macros to intercept the calls.
thank you all for your help :)
Gonçalo
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须迭代 app.commandbars 集合以查找特定的命令栏(在本例中为编辑菜单),然后通过命令进行交互以查找特定的菜单项,然后您应该能够挂钩单击事件,或禁用按钮(CommandBarButton 对象有一个可以设置的 ENABLED 属性,我相信您也可以在它们上设置 VISIBLE)。
请注意,在不同的语言中,标题可能会发生变化,因此最好键入 ID 属性。
这里有一篇文章介绍了如何获取这些名称和 ID
http://support.microsoft.com/kb/243988< /a>
You'll have to iterate through the app.commandbars collection to find the specific commandbar (in this case,the EDIT MENU) and then interate through the commands to find the specific menu items, then you should be able to hook the click events, or disable the buttons (CommandBarButton objects have an ENABLED property you can set, I believe you can also set VISIBLE on them).
Be aware that in different languages, the Caption can change, so it's best to key of the ID property.
Here's a post of how to get those names and ID's
http://support.microsoft.com/kb/243988