Detecting Installed Applications

  • Thread starter Thread starter Steve C. Orr [MVP, MCSD]
  • Start date Start date
S

Steve C. Orr [MVP, MCSD]

From my application that I will be widely deploying, I have several
applications that I need to check for programatically to see if they are
installed or not. I also need to get the path to these applications. After
searching through the registry, I don't see any single place that holds this
information.
Does anybody have any idea how I can get this information?
I suppose I could do a recursive search through the user's start menu if I
had to, but this would require opening shortcut files to see the target of
the shortcut, which I also do not know how to do from .NET.
Has anybody got any tips for me?

Thanks,
Steve Orr
 
The only semi-reliable way to do this is with apps installed with an MSI setup.
If you can find a productcode, upgradecode, or a component code (these are all
GUIDs) you can find if they're installed and where, using APIs like
MsiEnumRelatedProducts, MsiGetComponentPath (P/Invoke them). Non-MSI installs
are proprietary install setups and are all likely to have unique registry keys
in various places because there's no real standardization.
 
OK, so where are these APIs? They don't appear to be part of the .NET
framework so would I need to deploy them somehow so I can call them from
each workstation?
And are there any .NET code samples that use these APIs?

Thanks,
Steve Orr


Phil Wilson said:
The only semi-reliable way to do this is with apps installed with an MSI setup.
If you can find a productcode, upgradecode, or a component code (these are all
GUIDs) you can find if they're installed and where, using APIs like
MsiEnumRelatedProducts, MsiGetComponentPath (P/Invoke them). Non-MSI installs
are proprietary install setups and are all likely to have unique registry keys
in various places because there's no real standardization.
--
Phil Wilson [MVP Windows Installer]
----
Steve C. Orr said:
From my application that I will be widely deploying, I have several
applications that I need to check for programatically to see if they are
installed or not. I also need to get the path to these applications. After
searching through the registry, I don't see any single place that holds this
information.
Does anybody have any idea how I can get this information?
I suppose I could do a recursive search through the user's start menu if I
had to, but this would require opening shortcut files to see the target of
the shortcut, which I also do not know how to do from .NET.
Has anybody got any tips for me?

Thanks,
Steve Orr
 
I believe you need the Windows Installer SDK to you the API to which Phil refers. (See http://www.microsoft.com/msdownload/platformsdk/sdkupdate/default.htm?
p=/msdownload/platformsdk/sdkupdate/psdkredist.htm for download). Here is a list of functions that you may use: http://msdn.microsoft.com/library/default.asp?
url=/library/en-us/msi/setup/installer_function_reference.asp?frame=true



--------------------
From: "Steve C. Orr [MVP, MCSD]" <[email protected]>
References: <OG#[email protected]> <#[email protected]>
Subject: Re: Detecting Installed Applications
Date: Wed, 31 Mar 2004 18:13:02 -0800
Lines: 49
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <#[email protected]>
Newsgroups: microsoft.public.dotnet.framework.windowsforms
NNTP-Posting-Host: dsl-66-114-148-135.isomedia.com 66.114.148.135
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.windowsforms:64787
X-Tomcat-NG: microsoft.public.dotnet.framework.windowsforms

OK, so where are these APIs? They don't appear to be part of the .NET
framework so would I need to deploy them somehow so I can call them from
each workstation?
And are there any .NET code samples that use these APIs?

Thanks,
Steve Orr


Phil Wilson said:
The only semi-reliable way to do this is with apps installed with an MSI setup.
If you can find a productcode, upgradecode, or a component code (these are all
GUIDs) you can find if they're installed and where, using APIs like
MsiEnumRelatedProducts, MsiGetComponentPath (P/Invoke them). Non-MSI installs
are proprietary install setups and are all likely to have unique registry keys
in various places because there's no real standardization.
--
Phil Wilson [MVP Windows Installer]
----
Steve C. Orr said:
From my application that I will be widely deploying, I have several
applications that I need to check for programatically to see if they are
installed or not. I also need to get the path to these applications. After
searching through the registry, I don't see any single place that holds this
information.
Does anybody have any idea how I can get this information?
I suppose I could do a recursive search through the user's start menu if I
had to, but this would require opening shortcut files to see the target of
the shortcut, which I also do not know how to do from .NET.
Has anybody got any tips for me?

Thanks,
Steve Orr
 
These guys have a wrapper class for the P/Invoke calls. Scroll down to C#
wrapper zip file.
http://www.youseful.com/
--
Phil Wilson [MVP Windows Installer]
----
Steve C. Orr said:
OK, so where are these APIs? They don't appear to be part of the .NET
framework so would I need to deploy them somehow so I can call them from
each workstation?
And are there any .NET code samples that use these APIs?

Thanks,
Steve Orr


Phil Wilson said:
The only semi-reliable way to do this is with apps installed with an MSI setup.
If you can find a productcode, upgradecode, or a component code (these are all
GUIDs) you can find if they're installed and where, using APIs like
MsiEnumRelatedProducts, MsiGetComponentPath (P/Invoke them). Non-MSI installs
are proprietary install setups and are all likely to have unique registry keys
in various places because there's no real standardization.
--
Phil Wilson [MVP Windows Installer]
----
Steve C. Orr said:
From my application that I will be widely deploying, I have several
applications that I need to check for programatically to see if they are
installed or not. I also need to get the path to these applications. After
searching through the registry, I don't see any single place that holds this
information.
Does anybody have any idea how I can get this information?
I suppose I could do a recursive search through the user's start menu if I
had to, but this would require opening shortcut files to see the target of
the shortcut, which I also do not know how to do from .NET.
Has anybody got any tips for me?

Thanks,
Steve Orr
 
I should add that these are standard Win32 APIs present in every OS from Windows
2000 and up. On older OS versions, the Windows Installer redist needs
installing, but if it's not installed then there can't be anything installed
with MSI files anyway.
--
Phil Wilson [MVP Windows Installer]
----
Phil Wilson said:
These guys have a wrapper class for the P/Invoke calls. Scroll down to C#
wrapper zip file.
http://www.youseful.com/
--
Phil Wilson [MVP Windows Installer]
----
Steve C. Orr said:
OK, so where are these APIs? They don't appear to be part of the .NET
framework so would I need to deploy them somehow so I can call them from
each workstation?
And are there any .NET code samples that use these APIs?

Thanks,
Steve Orr


Phil Wilson said:
The only semi-reliable way to do this is with apps installed with an MSI setup.
If you can find a productcode, upgradecode, or a component code (these are all
GUIDs) you can find if they're installed and where, using APIs like
MsiEnumRelatedProducts, MsiGetComponentPath (P/Invoke them). Non-MSI installs
are proprietary install setups and are all likely to have unique registry keys
in various places because there's no real standardization.
--
Phil Wilson [MVP Windows Installer]
----
From my application that I will be widely deploying, I have several
applications that I need to check for programatically to see if they are
installed or not. I also need to get the path to these applications. After
searching through the registry, I don't see any single place that holds this
information.
Does anybody have any idea how I can get this information?
I suppose I could do a recursive search through the user's start menu if I
had to, but this would require opening shortcut files to see the target of
the shortcut, which I also do not know how to do from .NET.
Has anybody got any tips for me?

Thanks,
Steve Orr
 
Back
Top