象WORD一样,双击.doc的文件就自动打开WORD并编辑该文件(转)
一段很有用的代码,转过来看看。
1using Microsoft.Win32;
2using System.Reflection;
3AssemblyName an=new AssemblyName();
4 RegistryKey RegKey;
5 RegKey=Registry.ClassesRoot;
6 RegKey=RegKey.CreateSubKey("*\\shell\\MyApp");
7 RegKey.SetValue("","用程序打开");
8 RegKey=Registry.ClassesRoot;
9 RegKey=RegKey.CreateSubKey("*\\shell\\MyApp\\command");
10 RegKey.SetValue("",Application.ExecutablePath +" %1");
11 RegKey.Close();
2using System.Reflection;
3AssemblyName an=new AssemblyName();
4 RegistryKey RegKey;
5 RegKey=Registry.ClassesRoot;
6 RegKey=RegKey.CreateSubKey("*\\shell\\MyApp");
7 RegKey.SetValue("","用程序打开");
8 RegKey=Registry.ClassesRoot;
9 RegKey=RegKey.CreateSubKey("*\\shell\\MyApp\\command");
10 RegKey.SetValue("",Application.ExecutablePath +" %1");
11 RegKey.Close();
Difficulty of making decision depends on what to lose not gain