user242408
user242408

Reputation:

How to insert my application to Windows right click menu?

I would like to write a C# .NET program that will do some transformations to selected images. After I select several images on my desktop (or any other windows folder) and right click them, I would like to see my program in the appeared menu. How can I insert my program to this menu, and execute it when this option is clicked ? I would appreciate a little code example.

Thanks in advance !

Upvotes: 5

Views: 5436

Answers (1)

itowlson
itowlson

Reputation: 74842

The easiest way to do this is not through code but through registry entries. Add a key under HKCR / filetype / Shell (where filetype is the filetype associated with the file extension, e.g. jpegfile). The name of the key is your menu option (e.g. "Transform"). Under this create a key named Command, and set the value of this key to the command line for your program e.g. c:\myprogram\myprogram.exe "%1" (the %1 is where Explorer will substitute the file name of the right-clicked file).

Upvotes: 4

Related Questions