Checking for Installed Application.

  • Thread starter Thread starter ink
  • Start date Start date
I

ink

Hi All,

I need to check and see if an application is installed, namely TomTom.

Is the best way to just look for the EXE file?

Or is there a more correct way?

Thanks,
ink
 
I'm not aware of any CSPs or API to check this, but...
On PPC 2003 and earlier, one simple way was to check for the .unload file in
the \Windows folder. For example: \Windows\Microsoft .NET CF 2.0 ENU-String
Resource.unload. On Windows Mobile 5 and later you'd need to check for the
gac file or something similar ie: \Windows\System.SR.2.0.ENU.gac as .unload
files are no longer used. Bear in mind applications can be installed anywhere
IE: external flash or internal file system, it is probebly better practice to
check the registry.
 
Hi,

Simon Hart said:
I'm not aware of any CSPs or API to check this, but...

The uninstall CSP can sometimes (as odd as that may initially may seem) be
used for this purpose on a Pocket PC 2003 or above device.

See for example the "Query the Device for All Applications that can be
Uninstalled Example" on MSDN at
http://msdn2.microsoft.com/en-us/library/bb737288.aspx.

You can pass this XML to the DMProcessConfigXML API
(http://msdn2.microsoft.com/en-us/library/ms852998.aspx) or if you are a
managed developer use the
Microsoft.WindowsMobile.Configuration.ConfigurationManager class
(http://msdn2.microsoft.com/en-us/li...obile.configuration.configurationmanager.aspx)
on WM5.0 or above.

This technique won't work for applications or libraries which are installed
in ROM or are installed without support for uninstallation. In this case
however where TomTom can easily be uninstalled via the Remove Programs
control panel applet it should be detectable via this approach.

Hope this helps,
Christopher Fairbairn
 
Thank you both for your help.

Could you take a look at this code for me. i have never done this sort of
thing before and i am get an error that is just a code no message.

I have know idea how this should be working. Is this code correct?


Code:

public static Boolean IsSatNavInstalled()
{
try
{
string Xml = "<characteristic
type=\"UnInstall\"><characteristic-query type=\"TomTom
Navigator\"/></characteristic>";
XmlDocument query = new XmlDocument();
query.LoadXml(Xml);
XmlDocument appInstalledCheckTest =
ConfigurationManager.TestConfiguration(query, true);
// XmlDocument appInstalledCheck =
ConfigurationManager.ProcessConfiguration(query, true);

}
catch (Exception e)
{
throw new Exception("TomTom Check", e);
}

return true;
}




Error:

{"Error Code #: 2147500037"}
[System.SystemException]: {"Error Code #: 2147500037"}
_HResult: -2146233087
_innerException: null
_message: "Error Code #: 2147500037"
_methodDescs: {Dimensions:[25]}
HResult: -2146233087
InnerException: null
Message: "Error Code #: 2147500037"
StackTrace: "at
Microsoft.WindowsMobile.Configuration.ConfigurationManager.MainConfigurator()\r\nat
Microsoft.WindowsMobile.Configuration.ConfigurationManager.TestConfiguration()\r\nat
Mnetics.CEApp.Program.IsSatNavInstalled()




Thanks,
ink
 
Your XML is wrong. According to the docs you can't query an explicit
application, merely query *all* applications that are allowed to be
uninstalled. XML should look like:

<characteristic-query type="UnInstall"/>

Then query the results for the existance of TomTom.
Bear in mind this CSP only works if the app has been marked as
uninstallable, in which case I believe TomTom is.

The other issue with this is you don't know what version is installed unless
it is part of the app name.
--
Simon Hart
Visual Developer - Device Application Development MVP
http://simonrhart.blogspot.com


ink said:
Thank you both for your help.

Could you take a look at this code for me. i have never done this sort of
thing before and i am get an error that is just a code no message.

I have know idea how this should be working. Is this code correct?


Code:

public static Boolean IsSatNavInstalled()
{
try
{
string Xml = "<characteristic
type=\"UnInstall\"><characteristic-query type=\"TomTom
Navigator\"/></characteristic>";
XmlDocument query = new XmlDocument();
query.LoadXml(Xml);
XmlDocument appInstalledCheckTest =
ConfigurationManager.TestConfiguration(query, true);
// XmlDocument appInstalledCheck =
ConfigurationManager.ProcessConfiguration(query, true);

}
catch (Exception e)
{
throw new Exception("TomTom Check", e);
}

return true;
}




Error:

{"Error Code #: 2147500037"}
[System.SystemException]: {"Error Code #: 2147500037"}
_HResult: -2146233087
_innerException: null
_message: "Error Code #: 2147500037"
_methodDescs: {Dimensions:[25]}
HResult: -2146233087
InnerException: null
Message: "Error Code #: 2147500037"
StackTrace: "at
Microsoft.WindowsMobile.Configuration.ConfigurationManager.MainConfigurator()\r\nat
Microsoft.WindowsMobile.Configuration.ConfigurationManager.TestConfiguration()\r\nat
Mnetics.CEApp.Program.IsSatNavInstalled()




Thanks,
ink






Christopher Fairbairn said:
Hi,



The uninstall CSP can sometimes (as odd as that may initially may seem) be
used for this purpose on a Pocket PC 2003 or above device.

See for example the "Query the Device for All Applications that can be
Uninstalled Example" on MSDN at
http://msdn2.microsoft.com/en-us/library/bb737288.aspx.

You can pass this XML to the DMProcessConfigXML API
(http://msdn2.microsoft.com/en-us/library/ms852998.aspx) or if you are a
managed developer use the
Microsoft.WindowsMobile.Configuration.ConfigurationManager class
(http://msdn2.microsoft.com/en-us/li...obile.configuration.configurationmanager.aspx)
on WM5.0 or above.

This technique won't work for applications or libraries which are
installed in ROM or are installed without support for uninstallation. In
this case however where TomTom can easily be uninstalled via the Remove
Programs control panel applet it should be detectable via this approach.

Hope this helps,
Christopher Fairbairn
 
Hi Simon,

I have tried all three of these strings but i am still getting the same
error on all of them.

//string Xml = "<characteristic type=\"UnInstall\"><characteristic-query
type=\"TomTom Navigator\"/></characteristic>";
//string Xml = "<characteristic-query type=\"UnInstall\"/>";
// string Xml = "<characteristic type=\"UnInstall\"><characteristic-query
type=\"UnInstall\"/></characteristic>";

I got these from these 2 locations:
http://msdn2.microsoft.com/en-us/library/bb737288.aspx
http://msdn2.microsoft.com/en-us/library/bb737597.aspx

Are you looking at different documentation to the above.

Thanks
ink





Simon Hart said:
Your XML is wrong. According to the docs you can't query an explicit
application, merely query *all* applications that are allowed to be
uninstalled. XML should look like:

<characteristic-query type="UnInstall"/>

Then query the results for the existance of TomTom.
Bear in mind this CSP only works if the app has been marked as
uninstallable, in which case I believe TomTom is.

The other issue with this is you don't know what version is installed
unless
it is part of the app name.
--
Simon Hart
Visual Developer - Device Application Development MVP
http://simonrhart.blogspot.com


ink said:
Thank you both for your help.

Could you take a look at this code for me. i have never done this sort of
thing before and i am get an error that is just a code no message.

I have know idea how this should be working. Is this code correct?


Code:

public static Boolean IsSatNavInstalled()
{
try
{
string Xml = "<characteristic
type=\"UnInstall\"><characteristic-query type=\"TomTom
Navigator\"/></characteristic>";
XmlDocument query = new XmlDocument();
query.LoadXml(Xml);
XmlDocument appInstalledCheckTest =
ConfigurationManager.TestConfiguration(query, true);
// XmlDocument appInstalledCheck =
ConfigurationManager.ProcessConfiguration(query, true);

}
catch (Exception e)
{
throw new Exception("TomTom Check", e);
}

return true;
}




Error:

{"Error Code #: 2147500037"}
[System.SystemException]: {"Error Code #: 2147500037"}
_HResult: -2146233087
_innerException: null
_message: "Error Code #: 2147500037"
_methodDescs: {Dimensions:[25]}
HResult: -2146233087
InnerException: null
Message: "Error Code #: 2147500037"
StackTrace: "at
Microsoft.WindowsMobile.Configuration.ConfigurationManager.MainConfigurator()\r\nat
Microsoft.WindowsMobile.Configuration.ConfigurationManager.TestConfiguration()\r\nat
Mnetics.CEApp.Program.IsSatNavInstalled()




Thanks,
ink






Christopher Fairbairn said:
Hi,

I'm not aware of any CSPs or API to check this, but...

The uninstall CSP can sometimes (as odd as that may initially may seem)
be
used for this purpose on a Pocket PC 2003 or above device.

See for example the "Query the Device for All Applications that can be
Uninstalled Example" on MSDN at
http://msdn2.microsoft.com/en-us/library/bb737288.aspx.

You can pass this XML to the DMProcessConfigXML API
(http://msdn2.microsoft.com/en-us/library/ms852998.aspx) or if you are
a
managed developer use the
Microsoft.WindowsMobile.Configuration.ConfigurationManager class
(http://msdn2.microsoft.com/en-us/li...obile.configuration.configurationmanager.aspx)
on WM5.0 or above.

This technique won't work for applications or libraries which are
installed in ROM or are installed without support for uninstallation.
In
this case however where TomTom can easily be uninstalled via the Remove
Programs control panel applet it should be detectable via this
approach.

Hope this helps,
Christopher Fairbairn
 
I have got it.

Both of these work i was missing a parent "<wap-provisioningdoc>" TAG that
for some reason is not mentiond in the documentation. I found it on an
example (http://blogs.msdn.com/marcpe/archive/2005/10/18/482215.aspx)

Here is the Query and the result and

//This one returns all allpications that can be in installed
string Xml = "<wap-provisioningdoc><characteristic
type=\"UnInstall\"><characteristic-query
type=\"UnInstall\"/></characteristic></wap-provisioningdoc>";

The result looks like this:
?appInstalledCheck.InnerXml
"<wap-provisioningdoc><characteristic type=\"UnInstall\"><characteristic
type=\"UnInstall\">
<characteristic type=\"Microsoft .NET CF 2.0 ENU-String Resource\"><parm
name=\"uninstall\" value=\"0\" label=\"Microsoft .NET CF 2.0 ENU-String
Resource\" /></characteristic><characteristic type=\"Microsoft SQL Client
2.0 [EN]\"><parm name=\"uninstall\" value=\"0\" label=\"Microsoft SQL Client
2.0 [EN]\" /></characteristic><characteristic type=\"Microsoft SQL Client
2.0\"><parm name=\"uninstall\" value=\"0\" label=\"Microsoft SQL Client
2.0\" /></characteristic><characteristic type=\"Microsoft SQL Mobile 2005
[EN]\"><parm name=\"uninstall\" value=\"0\" label=\"Microsoft SQL Mobile
2005 [EN]\" /></characteristic><characteristic type=\"Microsoft SQL Mobile
2005 Replication\"><parm name=\"uninstall\" value=\"0\" label=\"Microsoft
SQL Mobile 2005 Replication\" /></characteristic><characteristic
type=\"Microsoft SQL Mobile 2005\"><parm name=\"uninstall\" value=\"0\"
label=\"Microsoft SQL Mobile 2005\" /></characteristic><characteristic
type=\"Microsoft .NET CF 2.0\"><parm name=\"uninstall\" value=\"0\"
label=\"Microsoft .NET CF 2.0\" /></characteristic><characteristic
type=\"Microsoft Remote Display Control\"><parm name=\"uninstall\"
value=\"0\" label=\"Microsoft Remote Display Control\" /></characteristic>
</characteristic></wap-provisioningdoc>"


And this will returns weather an indevidule application can be uninstalled
string Xml = "<wap-provisioningdoc><characteristic
type=\"UnInstall\"><characteristic-query type=\"TomTom
Navigator\"/></characteristic></wap-provisioningdoc>";

The result looks like this:
?appInstalledCheck.InnerXml
"<wap-provisioningdoc><characteristic type=\"UnInstall\"><nocharacteristic
type=\"TomTom Navigator\" /></characteristic></wap-provisioningdoc>"


This is the code now.

//string Xml = "<wap-provisioningdoc><characteristic
type=\"UnInstall\"><characteristic-query
type=\"UnInstall\"/></characteristic></wap-provisioningdoc>";
string Xml = "<wap-provisioningdoc><characteristic
type=\"UnInstall\"><characteristic-query type=\"TomTom
Navigator\"/></characteristic></wap-provisioningdoc>";

XmlDocument query = new XmlDocument();
query.LoadXml(Xml);

XmlDocument appInstalledCheck =
ConfigurationManager.ProcessConfiguration(query, true);

foreach (XmlNode node in
appInstalledCheck.DocumentElement.FirstChild.FirstChild.ChildNodes)
{
string someText = node.Attributes[0].InnerText;
}



i hope this helps any one else having this problem.
Thanks to all for there help.
ink






ink said:
Hi Simon,

I have tried all three of these strings but i am still getting the same
error on all of them.

//string Xml = "<characteristic type=\"UnInstall\"><characteristic-query
type=\"TomTom Navigator\"/></characteristic>";
//string Xml = "<characteristic-query type=\"UnInstall\"/>";
// string Xml = "<characteristic type=\"UnInstall\"><characteristic-query
type=\"UnInstall\"/></characteristic>";

I got these from these 2 locations:
http://msdn2.microsoft.com/en-us/library/bb737288.aspx
http://msdn2.microsoft.com/en-us/library/bb737597.aspx

Are you looking at different documentation to the above.

Thanks
ink





Simon Hart said:
Your XML is wrong. According to the docs you can't query an explicit
application, merely query *all* applications that are allowed to be
uninstalled. XML should look like:

<characteristic-query type="UnInstall"/>

Then query the results for the existance of TomTom.
Bear in mind this CSP only works if the app has been marked as
uninstallable, in which case I believe TomTom is.

The other issue with this is you don't know what version is installed
unless
it is part of the app name.
--
Simon Hart
Visual Developer - Device Application Development MVP
http://simonrhart.blogspot.com


ink said:
Thank you both for your help.

Could you take a look at this code for me. i have never done this sort
of
thing before and i am get an error that is just a code no message.

I have know idea how this should be working. Is this code correct?


Code:

public static Boolean IsSatNavInstalled()
{
try
{
string Xml = "<characteristic
type=\"UnInstall\"><characteristic-query type=\"TomTom
Navigator\"/></characteristic>";
XmlDocument query = new XmlDocument();
query.LoadXml(Xml);
XmlDocument appInstalledCheckTest =
ConfigurationManager.TestConfiguration(query, true);
// XmlDocument appInstalledCheck =
ConfigurationManager.ProcessConfiguration(query, true);

}
catch (Exception e)
{
throw new Exception("TomTom Check", e);
}

return true;
}




Error:

{"Error Code #: 2147500037"}
[System.SystemException]: {"Error Code #: 2147500037"}
_HResult: -2146233087
_innerException: null
_message: "Error Code #: 2147500037"
_methodDescs: {Dimensions:[25]}
HResult: -2146233087
InnerException: null
Message: "Error Code #: 2147500037"
StackTrace: "at
Microsoft.WindowsMobile.Configuration.ConfigurationManager.MainConfigurator()\r\nat
Microsoft.WindowsMobile.Configuration.ConfigurationManager.TestConfiguration()\r\nat
Mnetics.CEApp.Program.IsSatNavInstalled()




Thanks,
ink






Hi,

I'm not aware of any CSPs or API to check this, but...

The uninstall CSP can sometimes (as odd as that may initially may
seem) be
used for this purpose on a Pocket PC 2003 or above device.

See for example the "Query the Device for All Applications that can be
Uninstalled Example" on MSDN at
http://msdn2.microsoft.com/en-us/library/bb737288.aspx.

You can pass this XML to the DMProcessConfigXML API
(http://msdn2.microsoft.com/en-us/library/ms852998.aspx) or if you are
a
managed developer use the
Microsoft.WindowsMobile.Configuration.ConfigurationManager class
(http://msdn2.microsoft.com/en-us/li...obile.configuration.configurationmanager.aspx)
on WM5.0 or above.

This technique won't work for applications or libraries which are
installed in ROM or are installed without support for uninstallation.
In
this case however where TomTom can easily be uninstalled via the
Remove
Programs control panel applet it should be detectable via this
approach.

Hope this helps,
Christopher Fairbairn
 
Back
Top