Results 1 to 11 of 11

Thread: How To edit right click windows context menu

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2009
    Posts
    76

    How To edit right click windows context menu

    hELLO EVERYONE,

    I am looking for a code that can help me Disable Refresh Entry from Right Click Context Menu.

    One more thing is with refresh Menu entry I want to make a search in Context menu and if there is an entry name = abc than I want to disable it too. So any idea how to proceed.

    So far I have gathered this information that this command can help me, but as am a newbee in .NET i don't think I can code it myself therefore need some assistance can anyone help

    Code:
    BOOL EnableMenuItem(      
        HMENU hMenu,
        UINT uIDEnableItem,
        UINT uEnable
    );
    Note: I am not talking about Context menu inside a program, I am referring to windows context menu
    Last edited by riteshtechie; Jan 13th, 2010 at 04:13 AM.
    < advertising link removed by moderator >

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,423

    Re: How To edit right click windows context menu

    which Right Click Context Menu?

    you can use your own context menu for controls

  3. #3
    Frenzied Member HanneSThEGreaT's Avatar
    Join Date
    Nov 2003
    Location
    Vereeniging, South Africa
    Posts
    1,492

    Re: How To edit right click windows context menu

    To edit the System's context menus, you'd have to edit the registry, well mostly.

    here is a thread - yes, I know it is in the VB 6 forum, but it will still help you :

    http://www.vbforums.com/showthread.php?t=593181
    VB.NET MVP 2008 - Present

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Sep 2009
    Posts
    76

    Re: How To edit right click windows context menu

    i want to make refresh menu entry gray in explorer context menu
    < advertising link removed by moderator >

  5. #5
    Frenzied Member HanneSThEGreaT's Avatar
    Join Date
    Nov 2003
    Location
    Vereeniging, South Africa
    Posts
    1,492

    Re: How To edit right click windows context menu

    Erm.... Did you actually go to the link I have posted &#191;
    VB.NET MVP 2008 - Present

  6. #6
    Banned
    Join Date
    Aug 2009
    Posts
    33

    Re: How To edit right click windows context menu

    Why not use System.Windows.Controls.ContextMenu.
    You can find how to use it on MSDN.
    __________________________
    Sabrina Gage
    Last edited by si_the_geek; May 19th, 2010 at 06:00 PM. Reason: removed advertising link

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Sep 2009
    Posts
    76

    Re: How To edit right click windows context menu

    Quote Originally Posted by HanneSThEGreaT View Post
    Erm.... Did you actually go to the link I have posted ¿
    Yes and found nothing useful.
    Look this is what I want.

    I want to Gray down New Entry and refresh menu entry just like the PAste see below pic.

    < advertising link removed by moderator >

  8. #8
    Frenzied Member MaximilianMayrhofer's Avatar
    Join Date
    Aug 2007
    Location
    IM IN YR LOOP
    Posts
    2,001

    Re: How To edit right click windows context menu

    It may simply not be possible to do that. You need to understand how the windows context menu is built. When you right click, windows queries the registry for items. But it's not necessarily as simple as having a string with the name of your program and a word for the title. The Paste item for example is actually the result of a call to a registered dll that returns a windows context menu item. In the dll, the logic checks the clipboard for pastable data and if it doesn't find any, returns a disabled menu item. Otherwise it returns an enabled one.

    It's important that you understand this because of what it means to you. You cannot artificially disable another menu item. The menu items you see are not controls on a form. By the time that you see them, they are immutable. Static. The only way for you to influence the behaviour of other menu items is to gain access to the dlls that create them, and manipulate the code that generates them.

    This is likely to be extremely difficult though, as these dlls are usually written in C++.
    Last edited by MaximilianMayrhofer; Jan 13th, 2010 at 08:39 AM.

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Sep 2009
    Posts
    76

    Re: How To edit right click windows context menu

    May be its not that difficult

    EnableMenuItem Function - http://msdn.microsoft.com/en-us/libr...36(VS.85).aspx

    Regex.Replace Method - http://msdn.microsoft.com/en-us/libr...x.replace.aspx

    I can search for string yusing regex replave and disable menu item by EnableMenuItem Function

    But am not a good programmer, i knew the concept now! can any help me with this noe
    < advertising link removed by moderator >

  10. #10

    Thread Starter
    Lively Member
    Join Date
    Sep 2009
    Posts
    76

    Re: How To edit right click windows context menu

    I got from somewhere that Class ID of Windows Explorer Context menu is #32770 in Windows 7

    mau be this would be of some help
    < advertising link removed by moderator >

  11. #11
    Frenzied Member MaximilianMayrhofer's Avatar
    Join Date
    Aug 2007
    Location
    IM IN YR LOOP
    Posts
    2,001

    Re: How To edit right click windows context menu

    Those APIs were developed specifically for the dlls that I mentioned in my earlier post. It would be either completely or nearly impossible to retrieve the handle of the context menu any other way than from a dll specifically invoked by it, and as a result it is very much immutable to outside influence.

    I wrote a context menu a while back for an application that depending on the file type either returned different menu items or returned nothing. This made it very simple to implement file specific context menus. In the function I do have access to the handle of the context menu, obviously, but i'm going to risk a guess that my earlier advice, as far as any external application is concerned, still applies.
    Last edited by MaximilianMayrhofer; Jan 13th, 2010 at 08:49 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width