How can I detect if OUTLOOK is installed on a PC?

  • Thread starter Thread starter Bill Armitage
  • Start date Start date
B

Bill Armitage

I know how to detect the presence of Excel, Word, etc
using FindExecutable in Shell32.DLL with a VB Program.
These all create a temporary file with the correct
extension (.Xls, .Doc, etc) then FindExecutable function
can be used.
How do I programmically detect if OUTLOOK.EXE is
installed on a PC?
 
Hi!

Pass Outlook.Application to the following function:

BOOL GetComponentFilename(LPCWSTR progid /*
OLESTR("Outlook.Application") */, char *componentPath)
{
CLSID clsid;

componentPath[0] = 0;
if (SUCCEEDED(CLSIDFromProgID(progid,&clsid)))
{
LPOLESTR id;
if (SUCCEEDED(StringFromCLSID(clsid,&id)))
{
HKEY hKey;
char buf[100];

CW2AEX<200> sId(id);
wsprintf(buf,"CLSID\\%s\\LocalServer32",sId);

if (RegOpenKeyEx(HKEY_CLASSES_ROOT,buf,0,KEY_QUERY_VALUE,&hKey)
== ERROR_SUCCESS)
{
DWORD Type, DataSz = MAX_PATH*2;
if
(RegQueryValueEx(hKey,NULL,NULL,&Type,(LPBYTE)componentPath,
&DataSz) != ERROR_SUCCESS) componentPath[0] = 0;
RegCloseKey(hKey);
}
else
{
wsprintf(buf,"CLSID\\%s\\InprocServer32",sId);
if
(RegOpenKeyEx(HKEY_CLASSES_ROOT,buf,0,KEY_QUERY_VALUE,&hKey) ==
ERROR_SUCCESS)
{
DWORD Type, DataSz = MAX_PATH*2;
if
(RegQueryValueEx(hKey,NULL,NULL,&Type,(LPBYTE)componentPath,&DataSz)
!= ERROR_SUCCESS) componentPath[0] = 0;
RegCloseKey(hKey);
}
}
CoTaskMemFree(id);
}
}
return (componentPath[0] != 0);
}

Alexander Gorlach,
MAPILab Ltd. -- Must have Outlook add-ons
http://www.mapilab.com/
 
Hi Alexander Gorlach
Many thanks for your very helpful comments.
I would never have worked that one out in a million years.
Again thanks for your trouble. This has saved me
multiple options in my VB program because I now know
whether a student has OUTLOOK installed on his/her laptop
or not - absolutely brilliant.
With gratitude,
Bill Armitage
-----Original Message-----
Hi!

Pass Outlook.Application to the following function:

BOOL GetComponentFilename(LPCWSTR progid /*
OLESTR("Outlook.Application") */, char *componentPath)
{
CLSID clsid;

componentPath[0] = 0;
if (SUCCEEDED(CLSIDFromProgID(progid,&clsid)))
{
LPOLESTR id;
if (SUCCEEDED(StringFromCLSID(clsid,&id)))
{
HKEY hKey;
char buf[100];

CW2AEX<200> sId(id);
wsprintf(buf,"CLSID\\%s\\LocalServer32",sId);

if (RegOpenKeyEx (HKEY_CLASSES_ROOT,buf,0,KEY_QUERY_VALUE,&hKey)
== ERROR_SUCCESS)
{
DWORD Type, DataSz = MAX_PATH*2;
if
(RegQueryValueEx(hKey,NULL,NULL,&Type,(LPBYTE) componentPath,
&DataSz) != ERROR_SUCCESS) componentPath[0] = 0;
RegCloseKey(hKey);
}
else
{
wsprintf(buf,"CLSID\\% s\\InprocServer32",sId);
if
(RegOpenKeyEx
(HKEY_CLASSES_ROOT,buf,0,KEY_QUERY_VALUE,&hKey) ==
ERROR_SUCCESS)
{
DWORD Type, DataSz = MAX_PATH*2;
if
(RegQueryValueEx(hKey,NULL,NULL,&Type,(LPBYTE) componentPath,&DataSz)
!= ERROR_SUCCESS) componentPath[0] = 0;
RegCloseKey(hKey);
}
}
CoTaskMemFree(id);
}
}
return (componentPath[0] != 0);
}

Alexander Gorlach,
MAPILab Ltd. -- Must have Outlook add-ons
http://www.mapilab.com/
-----Original Message-----
From: Bill Armitage [mailto:[email protected]]
Posted At: Saturday, August 28, 2004 8:46 PM
Posted To: microsoft.public.outlook.general
Conversation: How can I detect if OUTLOOK is installed on a PC?
Subject: How can I detect if OUTLOOK is installed on a PC?

I know how to detect the presence of Excel, Word, etc
using FindExecutable in Shell32.DLL with a VB Program.
These all create a temporary file with the correct
extension (.Xls, .Doc, etc) then FindExecutable function
can be used.
How do I programmically detect if OUTLOOK.EXE is
installed on a PC?

.
 
Back
Top