一段很有用的代码,转过来看看。
1
using Microsoft.Win32;
2
using System.Reflection;
3
AssemblyName 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();

2

3

4

5

6

7

8

9

10

11
