|
@chentx
参考一下下
还有另外三种不同的实现方案
public static void RegisterFunction(Type type)
{
// Add the "Programmable" registry key under CLSID
Registry.ClassesRoot.CreateSubKey(
GetCLSIDSubKeyName(type, "Programmable"));
// Register the full path to mscoree.dll which makes Excel happier.
RegistryKey key = Registry.ClassesRoot.OpenSubKey(
GetCLSIDSubKeyName(type, "InprocServer32"), true);
key.SetValue("",
System.Environment.SystemDirectory + @"\mscoree.dll",
RegistryValueKind.String);
}
public static void UnregisterFunction(Type type)
{
// Remove the "Programmable" registry key under CLSID
Registry.ClassesRoot.DeleteSubKey(
GetCLSIDSubKeyName(type, "Programmable"), false);
}
private static string GetCLSIDSubKeyName(Type type, string subKeyName)
{
System.Text.StringBuilder s = new System.Text.StringBuilder();
s.Append(@"CLSID\{");
s.Append(type.GUID.ToString().ToUpper());
s.Append(@"}\");
s.Append(subKeyName);
return s.ToString();
} |
评分
-
1
查看全部评分
-
|