Results 1 to 28 of 28

Thread: [RESOLVED] Adding menu in desktop context menu

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2005
    Posts
    157

    Resolved [RESOLVED] Adding menu in desktop context menu

    Hello,


    Is a way to add your own menu in the desktop context menu as Nvidia drivers done, please?


    Thanks in advance.

  2. #2

    Thread Starter
    Addicted Member
    Join Date
    Oct 2005
    Posts
    157

    Re: Adding menu in desktop context menu

    Isn't there any solution in VB and apis?

  3. #3
    Addicted Member
    Join Date
    Jul 2006
    Location
    Adelaide, Australia
    Posts
    204

    Re: Adding menu in desktop context menu

    you probably have to write a value to registry

    try searching your registry for the words in the context menu (the words used for Nvidia)

    then, if you find them try adding one manually (you may need to restart your system before the changes take effect), if that works then you can programatically add the keys.

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Oct 2005
    Posts
    157

    Re: Adding menu in desktop context menu

    I haven't found any similar string in windows register! Where can I search now?

  5. #5
    Addicted Member
    Join Date
    Jul 2006
    Location
    Adelaide, Australia
    Posts
    204

    Re: Adding menu in desktop context menu

    no, i couldnt find anything either, i dont know where to suggest looking...

    could try emailing NVIDIA, they might tell you.

    oh, if u do find out be sure to post it here.

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Adding menu in desktop context menu

    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Oct 2005
    Posts
    157

    Re: Adding menu in desktop context menu

    What about putting that on the desktop pop up menu instead of explorer windows?

  8. #8
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Adding menu in desktop context menu

    Not sure what exact changes would be needed but should just be something similar to winzips (or othe apps that add a CM menu) registry entries but modify to execute your app.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Oct 2005
    Posts
    157

    Re: Adding menu in desktop context menu

    I'm not very sure when I modify windows register. I didn't really find where nvidia hides its stuffs to insert its own menu in desktop menu. Anyone could know which key it is?

  10. #10
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Adding menu in desktop context menu

    Its several keys just like the other example shows. I dont think we may have that solution on the forums. Have you tried a Google search?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  11. #11

    Thread Starter
    Addicted Member
    Join Date
    Oct 2005
    Posts
    157

    Re: Adding menu in desktop context menu

    Well, I'm trying, but until now it's not a success!

  12. #12
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Adding menu in desktop context menu

    Its not a simple thing and I havent had the need to do it yet either.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  13. #13

    Thread Starter
    Addicted Member
    Join Date
    Oct 2005
    Posts
    157

    Re: Adding menu in desktop context menu

    It's surprising that's is not as easy as you click on desktop for this menu ! It seems all desktop stuffs is difficult to manipulate. Nothing has been really done to personnalize desk with VB...

  14. #14
    Fanatic Member schoolbusdriver's Avatar
    Join Date
    Jan 2006
    Location
    O'er yonder
    Posts
    1,020

    Re: Adding menu in desktop context menu

    I read up on how to do this many years ago but never created an app to make use of it. And now I no longer have the information at hand. The menu item you see is contained in a dll. Not sure if it can be done in vb.

    Look under: "HKEY_CLASSES_ROOT\Directory\Background\shellex\ContextMenuHandlers" and you'll see GUIDs and subkeys containing GUIDs. These GUIDs reference the HKCR\CLSID section, which contain the reference to the dll. Sorry to give a bit of a negative answer, but it's all I have.

    EDIT: Also - HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved

    This may be of some use: http://www.oreilly.com/catalog/vbshe...pter/ch04.html
    Last edited by schoolbusdriver; May 6th, 2007 at 12:53 PM.

  15. #15

    Thread Starter
    Addicted Member
    Join Date
    Oct 2005
    Posts
    157

    Re: Adding menu in desktop context menu

    I've noticed that in registry adress HKEY_CLASSES_ROOT\Directory\Background\shellex\ContextMenuHandlers, indeed there is a folder whose the name is "NvCplDesktopContext", Nv for nvidia... It was surprising to see that : why is it in "Directory"?
    I've tried to play with dll exemple and I put it here (and I desactivated the file selection in dll as I could). But nothing, no changes! We're near the problem.

  16. #16
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Adding menu in desktop context menu

    Its not as simple as adding a single registry key. There are InPorcessServer keys and class keys to create too.

    Its not called a folder but rather a Hive when referencing registry "folders". The item that stores the actual info is called the Key.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  17. #17

    Thread Starter
    Addicted Member
    Join Date
    Oct 2005
    Posts
    157

    Re: Adding menu in desktop context menu

    Could not we use getmenu and menu api management to do that?

  18. #18
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729

    Re: Adding menu in desktop context menu

    You can hook into the desktop and on INITMENUPOPUP you can add your own menu item. I've done it for TaskBar context menu and RTB context menu. Here is a similar code: http://www.vbforums.com/showthread.php?t=376337


    I didn't find the registry keys that time, so I don't know how it can be done by editing registry.
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


  19. #19

    Thread Starter
    Addicted Member
    Join Date
    Oct 2005
    Posts
    157

    Re: Adding menu in desktop context menu

    I've tried your application which changes Richtextbox popup menu (it seems there is a cursor problem : it doesn't change as default when popup is shown).
    I've change hwnd, and I've tried with notepad popup menu. Nothing happens ; WM_INITPOPUPMENU isn't detected by hook ocx. This is the same with superior layer of the desktop!

  20. #20
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729

    Re: Adding menu in desktop context menu

    You need to hook into SHELLDLL_DefView, which is the parent of the desktop listview.
    Just replace cmdHook_Click with the following code and it will work.


    vb Code:
    1. Private Sub cmdHook_Click()
    2.  
    3.     Dim hProgman As Long
    4.     Dim hSHELLDLLDefView As Long
    5.     hProgman = FindWindow("Progman", "Program Manager")
    6.     hSHELLDLLDefView = FindWindowEx(hProgman, 0&, "SHELLDLL_DefView", vbNullString)
    7.     lngHwndTargetForm = hProgman
    8.     lngHwndTargetRTB = hSHELLDLLDefView
    9.  
    10.     '--------------------------------------
    11.     If lngHwndTargetRTB = 0 Then
    12.         MsgBox "Could not find target window." & vbCrLf & _
    13.            "Make sure TestExe.exe is running"
    14.         Exit Sub
    15.     Else
    16.  
    17.         With ctlRTBHook
    18.             'Set hook paramters
    19.             .AddMessage WM_INITMENUPOPUP, "WM_INITMENUPOPUP"
    20.             .AddMessage WM_UNINITMENUPOPUP, "WM_UNINITMENUPOPUP"
    21.             .AddMessage WM_MENUSELECT, "WM_MENUSELECT"
    22.             .AddMessage WM_EXITMENULOOP, "WM_EXITMENULOOP"
    23.             .AddMessage WM_LBUTTONUP, "WM_LBUTTONUP"
    24.             .TargethWnd = lngHwndTargetRTB
    25.             .SetHook
    26.         End With
    27.  
    28.     End If
    29.  
    30. End Sub
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


  21. #21

    Thread Starter
    Addicted Member
    Join Date
    Oct 2005
    Posts
    157

    Re: Adding menu in desktop context menu

    Why doesn't it run as well in Notepad edit text box popup menu?

  22. #22
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729

    Re: Adding menu in desktop context menu

    Notepad receives WM_CONTEXTMENU. Not WM_INITMENUPOPUP.
    I've never successfully added menuitem in popups that are called by WM_CONTEXTMENU.
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


  23. #23

    Thread Starter
    Addicted Member
    Join Date
    Oct 2005
    Posts
    157

    Re: Adding menu in desktop context menu

    What is the differences between the two messages?

    Following your program, I tried myself to color my submenu add-in in desktop menu. It didn't run. Using your menu sub ("format menu") of this program, I coloured with setmenuinfo. I used getsubmenu to get sub menu handle (I had a null sub handle although submenus were counted), and nothing happened. Have you finally achieved your color menu program?

  24. #24
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729

    Re: Adding menu in desktop context menu

    Re: color menu:-
    Nope. The problem is still unresolved. At last I gaveup hope.

    Re: differences between the two messages:-
    I don't know why some app uses WM_CONTEXTMENU and why some app uses WM_INITMENUPOPUP.

    Quote Originally Posted by sephiroth2m of CodeGuru
    I think system classes do not fire WM_INITMENUPOPUP, which allows user to change the menu before dysplay it, like user-defined classes do. WM_CONTEXTMENU, in my opnion, is useless because it just works like WM_RBUTTONUP/DOWN works.
    Some links that may help you-
    WM_CONTEXTMENU Notification
    WM_INITMENUPOPUP Notification
    http://www.codeguru.com/forum/showthread.php?t=284940
    http://www.codeguru.com/forum/showthread.php?p=1052339

    But, your original problem can be easily solved using WM_INITMENUPOPUP. (or using the PROPER WAY - registry editing and shell dll)

    Why you want WM_CONTEXTMENU ? Is it just for knowledge or you want to modify menu of some other window too ?
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


  25. #25
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729

    Re: Adding menu in desktop context menu

    Idea for trapping popup menus created after processing WM_CONTEXTMENU: (NOT TESTED)

    1. Subclass the control where user right clicks.
    2. When you receive WM_CONTEXTMENU, enable a timer (with very little interval - 10ms)
    3. From inside the timer look for the menu (class name "#32768") using FindWindow (or may be FindWindowEx) API.
    4. Once you get hWnd of the menu, you can add new manuitems.
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


  26. #26

    Thread Starter
    Addicted Member
    Join Date
    Oct 2005
    Posts
    157

    Re: Adding menu in desktop context menu

    Thanks, I have managed to add a menu to desktop menu as I've wanted. I would like to get also the way to color menu of my own, and I hope someone will achieve later.

  27. #27
    New Member
    Join Date
    Dec 2007
    Posts
    1

    Re: [RESOLVED] Adding menu in desktop context menu

    Coul you show the final solution?

    And specifically fine?

    Please!

  28. #28

    Thread Starter
    Addicted Member
    Join Date
    Oct 2005
    Posts
    157

    Re: [RESOLVED] Adding menu in desktop context menu

    It is old for me! I haven't read these lines until now. I use them in my program but I think it would be easier to extract files that are dealing with the topic of this thread. I hope I have all of them.
    I was satisfied with a hook procedure of the desktop, and finally i abandon colored menu possibilities. I only use iprank's solution suggested in this thread, not more, only small adaptations.

    This files would probably not run because they call functions and other stuffs of my program. This is only for reading. I'm sorry but you're going to sort what is useful for this thread because I never well formated this insert menu solution.
    We need a hook control Hookcontrol.ocx.We use a ghost window, F0, that has all operations of my program (that uses as systray program...). The F0 form is not visible. We also need a classic module HK for declarations relative to the menu hook procedure. The F0 form has the lines to build the menu. You have to use a main sub to launch hkcinit to start the hook. Finally when you click with your right mouse button on the desktop, you must have your own menu inserted in your common desktop menu!

    Hookcontrol.txt has to be changed in hookcontrol.ocx and it is must be in the same folder as F0.frm.

    You should also see iprank's examples http://www.vbforums.com/showthread.php?t=376337
    Attached Files Attached Files
    Last edited by IsWorking; Dec 10th, 2007 at 09:39 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