I don't know if this is even possible, but how can I bind some key combina开发者_运维问答tion to a (C#)program, so that when that keyboard shortcut is pressed with some file selected in windows explorer, it calls specific function with path of that file as a parameter.
Or can I assign some keyboard shortcut so that windows explorer opens selected file in my program(that way I could pass the path to already running instance)
thanks
You could modify your program to run as a shell extension which would add an item for your program to the right-click menu in windows explorer, but apparently coding shell extensions in C# is a bad idea.
As an alternative, with a little work AutoHotkey can do this. Here's a sample script that renames the selected file in Windows Explorer when a certain keyboard combination is pressed. You could modify it to run your C# program and pass the selected filename.
精彩评论