How to search and reteieve the value of a key in the registry-VC++

Athish's Avatar, Join Date: Feb 2007
Newbie Member
How to search and reteieve the value of a key in the registry through VC++ Application??
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Open Main Key with RegOpenKeyEx and get the necessary value with RegQueryValueEx API's
Athish's Avatar, Join Date: Feb 2007
Newbie Member
thanks for your reply shabbir..

i have one more query....kindly read the below one,


How to retrieve the ORACLE_HOME location from the Registry Editor through VC++ application, irrespective of the Oracle Version(either 9i or 10 G)??

Because, the ORACLE_HOME resides in different folders w.r.to the oracle version.

Currently, we are using a MFC function (RegOpenKeyEx()) to retrieve the ORACLE_HOME Location but this function requires the Complete folder path (For Instance,., SOFTWARE\\ORACLE for Oracle 9i and SOFTWARE\\ORACLE\\Key_oraclientlog_home2 for Oracle 10 G)

Instead of hardcoding the Complete folder path(as i mentioned above), is there an universal way to retreive the ORACLE_HOME Location from the Registry editor without mentioning the complete Folder path???

Please Advise..

Thanks Aathi
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
That would depend on the Oracle and if you dont have any docs relating to Oracle installation its always not a good method to be finding it because a new version will break your system.
Athish's Avatar, Join Date: Feb 2007
Newbie Member
thank you for your view....

how to go about with this issue???

Better to hard code the location according to the Oracle Version for time being...anyway i agree with you that i need to rewrite again if any other newer version of oracle comes...

orelse any other better idea u can suggest????


thanks Aathi
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Have an ini file to have the probable locations and as and when new version comes up you can just add to the ini file so you dont need to be editing the code all the time or at clients place.