指定注册或反注册的位置(位于注册表中):
public class ClassCommand
{
[ComRegisterFunction()]
public static void RegistryCommand(string regKey)
{
Microsoft.Win32.Registry.ClassesRoot.CreateSubKey(regKey.Substring(18) + "\\Implemented Categories\\" + "{E5BDE9F2-167C-49BD-B05C-BCDF47B297FF}");
}
[ComUnregisterFunction()]
public static void UnregisterCommand(string regKey)
{
Microsoft.Win32.Registry.ClassesRoot.DeleteSubKey(regKey.Substring(18) + "\\Implemented Categories\\" + "{E5BDE9F2-167C-49BD-B05C-BCDF47B297FF}");
}
}
使用方法示例:
[ClassInterface(ClassInterfaceType.None)]
[Guid("9DD159BA-78C1-4FA1-8FE0-B1FBB6EB41F6")]
public class CTestXXZX : ClassCommand
{
}