How to check if my com add-in already installed

Y

Yael

From C# code:

I have com add-in to outlook 2003, code in c#.
1) I want to check if this add-in already installed in this computer.

private void isOutlook()
{
Microsoft.Win32.RegistryKey key =
Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software\\microsoft\\windows\\currentversion\\app paths\\OUTLOOK.EXE");
string path = (string)key.GetValue("Path"); if( path != null)// if have
outlook do the installing com add-in
//if this com add-in not yet installed

System.Diagnostics.Process.Start("C:\\MatarotToolbar\\MatarotToolbarSetup\\Debug\\Setup.Exe");
}

2 ) How can I check from C# code if outlook program is already running?
if not, I run outlook with:
System.Diagnostics.Process.Start("OUTLOOK.EXE");
 
Y

Yael

this method not good, I get error:
An unhandled exception of type 'System.NullReferenceException' occurred in
OutlookChecker.exe
Additional information: Object reference not set to an instance of an object.

private bool IsAlreadyInstalled()
{
string proId = "MatarotToolbar.Connect";

RegistryKey key = Registry.LocalMachine.OpenSubKey
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\HKEY_CLASSES_ROOT\\" + proId);

string path = (string)key.GetValue("Path");
if( path != null)
return false;
return true;
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top