Registry
// To load this DLL into OE/WM, it must be added to OEAPI's key in the registry
// and OEAPI's launcher.exe (or your own EXE launcher) must be running from startup
[ComRegisterFunction]
public static void RegisterFunction(Type t)
{
try {
// Attempt to open the key
RegistryKey key = Registry.CurrentUser.OpenSubKey("Software\\Nektra\\OEAPI\\Plugins", true);
// If the return value is null, the key doesn't exist
if (key == null) {
// The key doesn't exist; create it / open it
key = Registry.CurrentUser.CreateSubKey("Software\\Nektra\\OEAPI\\Plugins");
}
//SetValue (string name, Object value)
//name can be set any string,but if has many name OE will initialize many name setting,so best set "Plugin".
//value : namespace.classname.
key.SetValue("NewsOEAgentPlugin", (string) "news.oe.NewsOEAgent");
}catch(Exception ex) {
Console.WriteLine(ex.Message);
Console.WriteLine(ex.StackTrace);
}
}
[ComUnregisterFunctionAttribute]
public static void UnregisterFunction(Type t)
{
try {
// Attempt to open the key
RegistryKey key = Registry.CurrentUser.OpenSubKey("Software\\Nektra\\OEAPI\\Plugins");
key.DeleteValue("NewsOEAgentPlugin"); //if 'true' is added as a second parameter, eventual exceptions will be thrown
}catch(Exception ex) {
Console.WriteLine(ex.Message);
Console.WriteLine(ex.StackTrace);
}
}
然后打开Outlook Express,这时候设置工程属性