c# - How I Can Check If App Installed -


i have code check if .net installed , , work good

string key; bool data = false;  try {     key = registry.localmachine.opensubkey("software").opensubkey("microsoft").opensubkey("windows").opensubkey("currentversion").opensubkey("uninstall").getvalue("50727").tostring(); } catch (exception) { } data = (key == "50727-50727"); label1.text = "installed"; 

i tried used same code change location anothor apps faild

32bit system

string key1; bool data1 = false;           try {     key1 = registry.localmachine.opensubkey("software").opensubkey("wow6432node").opensubkey("microsoft").opensubkey("windows").opensubkey("currentversion").opensubkey("uninstall").opensubkey("mozilla firefox 38.0.1 (x86 en-gb)").getvalue("displayname").tostring(); } catch (exception) { }  data1 = (key1 == "mozilla firefox 38.0.1 (x86 en-gb)"); label10.text = "mozilla firefox - " + data1.tostring(); 

64bit system

string key1; bool data1 = false;   try {     key1 = registry.localmachine.opensubkey("software").opensubkey("microsoft").opensubkey("windows").opensubkey("currentversion").opensubkey("uninstall").opensubkey("mozilla firefox 38.0.1 (x86 en-gb)").getvalue("displayname").tostring(); } catch (exception) { }  data1 = (key1 == "mozilla firefox 38.0.1 (x86 en-gb)"); label10.text = "mozilla firefox - " + data1.tostring(); 

any idea ?

i open regedit , navigate path.

hkey_local_machine\software\microsoft\windows\currentversion\uninstall...

first, make sure name there. if not issue.

it key looking going hkey_local_machine\software\microsoft\windows\currentversion\uninstall{0b0ba4a44-b2ab-4b28-9a45-cbe2bfc5ffd1}

if case need iterate through each item in registry.localmachine.opensubkey("software").opensubkey("microsoft").opensubkey("windows").opensubkey("currentversion").opensubkey("uninstall") , wanted displayname. (see iterate through registry entries)

just note, since looking "mozilla firefox 38.0.1 (x86 en-gb)" if not exact on pc not find it. if version 38.0.2 example or if browser en version in us. @ mark shevchenko comment best general checking. using uninstall path might not reliable.

by way, there similar question here: check if application installed in registry

hope helps.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -