象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();
posted @ 2007-05-18 11:38  芈老头  阅读(1368)  评论(2编辑  收藏  举报