Hi 轮回的齿轮,
在win8之前你可以尝试修改shell来修改文件默认的打开方式.
1.
首先你需要找出文件的类型.
var imgKey = Registry.ClassesRoot.OpenSubKey(".jpg")
var imgType = key.GetValue("");
2.
然后找出可执行文件的路径,修改command
字符串
String myExecutable = Assembly.GetEntryAssembly().Location;
String command = "\"" + myExecutable + "\"" + " \"%1\"";
3.
然后注册你的可执行文件.
String keyName = imgType + @"\shell\Open\command";
using (var key = Registry.ClassesRoot.CreateSubKey(keyName)) {
key.SetValue("", command);
}
希望这些能帮助到你.
Best Regards,
Hart
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints
to MSDN Support, feel free to contact MSDNFSF@microsoft.com.