Hello,
Is a way to add your own menu in the desktop context menu as Nvidia drivers done, please?
Thanks in advance.
Printable View
Hello,
Is a way to add your own menu in the desktop context menu as Nvidia drivers done, please?
Thanks in advance.
Isn't there any solution in VB and apis?
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.
I haven't found any similar string in windows register! Where can I search now?
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.
What about putting that on the desktop pop up menu instead of explorer windows?
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.
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?
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?
Well, I'm trying, but until now it's not a success!
Its not a simple thing and I havent had the need to do it yet either.
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...
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
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.
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.
Could not we use getmenu and menu api management to do that?
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.
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!
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:
Private Sub cmdHook_Click() Dim hProgman As Long Dim hSHELLDLLDefView As Long hProgman = FindWindow("Progman", "Program Manager") hSHELLDLLDefView = FindWindowEx(hProgman, 0&, "SHELLDLL_DefView", vbNullString) lngHwndTargetForm = hProgman lngHwndTargetRTB = hSHELLDLLDefView '-------------------------------------- If lngHwndTargetRTB = 0 Then MsgBox "Could not find target window." & vbCrLf & _ "Make sure TestExe.exe is running" Exit Sub Else With ctlRTBHook 'Set hook paramters .AddMessage WM_INITMENUPOPUP, "WM_INITMENUPOPUP" .AddMessage WM_UNINITMENUPOPUP, "WM_UNINITMENUPOPUP" .AddMessage WM_MENUSELECT, "WM_MENUSELECT" .AddMessage WM_EXITMENULOOP, "WM_EXITMENULOOP" .AddMessage WM_LBUTTONUP, "WM_LBUTTONUP" .TargethWnd = lngHwndTargetRTB .SetHook End With End If End Sub
Why doesn't it run as well in Notepad edit text box popup menu?
Notepad receives WM_CONTEXTMENU. Not WM_INITMENUPOPUP.
I've never successfully added menuitem in popups that are called by WM_CONTEXTMENU. :(
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?
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.
Some links that may help you-Quote:
Originally Posted by sephiroth2m of CodeGuru
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 ?
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.
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.
Coul you show the final solution?
And specifically fine?
Please!
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