Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

What's the easiest/best way to register your program in explorers right-click menu using .NET and C#?
i.e. I would like to be able to right-click on an item in windows explorer and get a "Edit with MyProgram"

This is the closest thing to a tutorial I could find but it mostly just dips into Win32 from .NET and is also outdated. How should this be done now?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
226 views
Welcome To Ask or Share your Answers For Others

1 Answer

If you just want to add menu items, then a shell extension is overkill. You can register a command line in the registry which will run your exe with the selected file(s) as the parameter. Shell extensions are really only required if you want to change explorer's behavior, add custom icons, or hook shell based file operations.

http://www.codeproject.com/KB/shell/SimpleContextMenu.aspx

If a shell extension is what you need, you're best writing a thin wrapper in unmanaged code that calls out to another process that is your .NET application through some sort of cross process communication channel. Due to all the potential versioning issues, it's not recommended to load the .NET runtime into the explorer process.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...