How to disable copy/paste commands in the Windows edit control context menu?

前端 未结 4 1944
陌清茗
陌清茗 2020-12-16 05:38

How can I disable those 3 standard cut/copy/paste commands in the context menu of the native Windows OS edit control?

I also need to disable the equivalent

4条回答
  •  萌比男神i
    2020-12-16 06:03

    I found one interesting idea of how to get the handle of the edit control's context menu on vbforums.com:

    http://www.vbforums.com/showthread.php?776385-RESOLVED-Modify-right-click-context-menu-in-standard-controls

    It demonstrates how to add custom context menu items to the standard OS context menu. I think, this idea can be used to modify the menu too. Theoretically I need to enumerate the menu items and disable the items related to the copy/paste commands. The question is how to know whether a menu item is related to copy/paste? Getting the menu item text is a bad idea ;)

    Another problem of that code is that it is based on some Windows features that are not documented. I've checked the solution, it still works in Windows 10, but who knows how the edit control context menu may be changed in the future updates of the OS...

提交回复
热议问题