add to windows context menu?

Johnson

Well-known member
Joined
Mar 6, 2009
Messages
158
Programming Experience
Beginner
What i would like to do is have my application add a entry to the main windows context menu(for when i right click a picture) which will be called host image.

My question is what do i need to read up on to add a context menu entry

When the entry is clicked i want it to get the file it's clicked on location

Does this make some sort of sense to you?
 
[ame=http://www.google.com.au/search?hl=en&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&hs=ErY&q=shell+extension+.net&btnG=Search&meta=]shell extension .net - Google Search[/ame]

It looks like it's easier to find C# examples so you might need to convert some code. I recommend Instant VB.
 
Right, i found a project to convert to vb.net.

it adds a entry and lets you select what exe to run when click.

My question is, I need to capture the file it was right clicked on, so when my application runs it knows what file to work with.

is this difficult?
 
Most likely this info will be available in command line arguments. I don't know if registry path has to be modified in your case, often a %1 is appended.
In applications Startup event you can find this in e.CommandLine. It is also found in My.Application.CommandLineArgs or Environment.GetCommandLineArgs.
 
If your Reg entry says "MyApp.exe %1" then, when the user clicks MyFile.txt then Windows executes the commandline "MyApp.exe MyFile.txt" and, in your app, Environment.GetCommandLineArgs returns the array {"MyApp.exe", "MyFile.txt"}. Easy. :)
 
Back
Top