Thread: Adding commands to common context menus

  1. #1
    Registered User Orderbringer's Avatar
    Join Date
    Apr 2005
    Posts
    2

    Question Adding commands to common context menus

    What sequence of function calls or manual steps could I take to add a command to an existing Windows context menu?

    For example, clicking within a text box with the secondary mouse button summons a menu with the familiar Cut, Copy, Paste, and Delete commands. How could I add a new command of this type programmatically or manually?

    Thanks for your assistance.

  2. #2
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    Welcome to the forums!

    The general consensus suggests that this is not easily possible. The usual solution is to subclass the edit control, handle WM_CONTEXTMENU and replace the built-in menu with your own. A partial example of this approach is given here.

  3. #3
    Registered User Orderbringer's Avatar
    Join Date
    Apr 2005
    Posts
    2
    Alright, but what if my program doesn't own the edit control in question? (I want to affect the context menu containing Cut, Copy, Paste, etc. globally, across the entire system.)

    Nevertheless, thanks for your response, and I appreciate the welcome!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. SVN Import Causes Crash
    By Tonto in forum Tech Board
    Replies: 6
    Last Post: 11-01-2006, 03:44 PM
  2. Adding to the Internet Explorer context menu
    By bennyandthejets in forum Windows Programming
    Replies: 9
    Last Post: 04-25-2004, 05:27 AM
  3. adding menus at runtime
    By bennyandthejets in forum Windows Programming
    Replies: 3
    Last Post: 11-22-2002, 05:07 AM
  4. Context Menu, ...helper menus?
    By MrWizard in forum C++ Programming
    Replies: 3
    Last Post: 04-05-2002, 02:25 AM
  5. Context Menus
    By Gary in forum Windows Programming
    Replies: 4
    Last Post: 03-30-2002, 03:49 PM