PDA

View Full Version : RegKeyExist



Worti
11-12-2009, 02:04 AM
it would be nice we can check an value data in the registry.

I have to check is there an value in the ODBC Data Sources.
If im use Registry.DoesKeyExist, the Registry exist on every System. But not everyone have the value, or data inside.


(HKEY_LOCAL_MACHINE,"SOFTWARE\\ODBC\\ODBC.INI\\ODBC Data Sources","softadm","DataDirect 4.20 32-BIT OpenEdge SQL v10.0B");

(HKEY_LOCAL_MACHINE,"SOFTWARE\\ODBC\\ODBC.INI\\ODBC Data Sources","softadm","Progress OpenEdge 10.2A Driver",REG_SZ);

Regards,
Rolf

Darryl
05-20-2010, 11:33 AM
Maybe I'm misunderstanding, but wouldn't checking the returned result of Registry.GetValue accomplish what you're trying to do?

Worti
05-20-2010, 04:12 PM
Hi Darryl

if i try to check the value in HKLM i receive nothing. But in the Path i have C:\Program Files\7-Zip


-- Read the value.
registry_value = Registry.GetValue(HKEY_LOCAL_MACHINE, "Software\\7-Zip", "Path", true);

-- Display the value read from the Registry in a dialog.
Dialog.Message("Registry Data", "The value read from the Registry is "..registry_value..".");


if i try the same under HKCU the Dialog Message are correct.


-- Read the value.
registry_value = Registry.GetValue(HKEY_CURRENT_USER, "Software\\7-Zip", "Path", true);

-- Display the value read from the Registry in a dialog.
Dialog.Message("Registry Data", "The value read from the Registry is "..registry_value..".");


actually i check this with Registry.DoesKeyExist, but would be nice i can check an value in HKLM

System is an Win7 x64 with the lastest SUF

Ulrich
05-20-2010, 04:28 PM
Setup Factory is a 32-bit application, and is being redirected when you try to access 64-bit registry hives.
http://msdn.microsoft.com/en-us/library/aa384253(v=VS.85).aspx

Ulrich

Worti
05-20-2010, 04:43 PM
thanks Ulrich

now i understand :yes

Rolf