How can I enable/disable CEdit control context menu items?
-
well the subject says it all. I need to be able to enable/disable/hook the cut/copy/paste commands from the default CEdit control context menu. thanks ahead of time for pointing me in the right direction. byron
-
well the subject says it all. I need to be able to enable/disable/hook the cut/copy/paste commands from the default CEdit control context menu. thanks ahead of time for pointing me in the right direction. byron
You'll need to subclass CEdit and handle the WM_CUT, WM_COPY, and WM_PASTE messages.
-
You'll need to subclass CEdit and handle the WM_CUT, WM_COPY, and WM_PASTE messages.
Erik, Thanks for your response. I have CEdit subclassed already and I can trap the WM_COPY/CUT/PASTE messages there if I needed to in ::WindowProc. But I want to disable the menu items in the first place. In a nutshell what I am trying to do is have a custom 'read-only' state in the edit control. So I would like to be able to disable the Cut/Delete/Paste items of the default CEdit context menu when my control is 'read-only'. That way the user doesn't even have the option of selecting it. The only thing I can think of is to create my own pop-up menu and look for a right click or that other windows key. Which is do-able, but I'd rather just be able to enable/disable the default context menu items at will. Any ideas? Byron
-
Erik, Thanks for your response. I have CEdit subclassed already and I can trap the WM_COPY/CUT/PASTE messages there if I needed to in ::WindowProc. But I want to disable the menu items in the first place. In a nutshell what I am trying to do is have a custom 'read-only' state in the edit control. So I would like to be able to disable the Cut/Delete/Paste items of the default CEdit context menu when my control is 'read-only'. That way the user doesn't even have the option of selecting it. The only thing I can think of is to create my own pop-up menu and look for a right click or that other windows key. Which is do-able, but I'd rather just be able to enable/disable the default context menu items at will. Any ideas? Byron
[windows 7 - How can i modify the context menu of a CEdit control? - Stack Overflow](https://stackoverflow.com/q/6265251/2287576)