Accessing "Open with" context menu
I have a file browser in my VB.net application and I'm trying to either
a) display the native Explorer file context menu so that users can manipulate files as in Explorer
or
b) create a vb.net context menu and list out the associated applications from the registry.
I have got nowhere with option a) and have been playing with option b).
So far I have got the default association for my "open" option (\shell\open\command), but poking around in the registry I can't see how to recreate the "open with" list.
Although in some cases I can see an open with stub and some progId stubs I can't seem to work out a definitive open with list that is standard for each file type.
Any thoughts on either of these?
Re: Accessing "Open with" context menu
Re: Accessing "Open with" context menu
here's a simplified vb.net solution:
Code:
Process.Start("RUNDLL32.EXE", "shell32.dll,OpenAs_RunDLL " & FileName)
where FileName is a full file path
Re: Accessing "Open with" context menu
Thanks but I've see that link and that is the choose program menu option dialog which as an aside could be useful but I'm after the "open with" context menu items to list them on my datagridview context menu.
Re: Accessing "Open with" context menu
After some further digging I've found various class references :
HKEY_LOCAL_MACHINE\SOFTWARE\Classes
HKEY_LOCAL_CURRENT_USER\SOFTWARE\Classes
Also something similar for Explorer....
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\
So somewhere between these and Microsoft.Win32.Registry.ClassesRoot seems to lie the list.
However it isn't as simple as the "openwith" registry key as it seems to use the "progid" in places too.
If anyone has a simple routine or algorithm to piece together the "open with" list puzzle it would be much appreciated.
Re: Accessing "Open with" context menu
I found a c# example of what I'm trying to do.
I'm not 100% sure it works yet and I need to translate it to vb.net, but it suggests and looks like it does what I need.
http://social.msdn.microsoft.com/For...6-28a781b37f72