I would like to write a C开发者_JAVA百科# .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 !
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).
精彩评论