Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RegQueryValueEx problem with w95 and 98 in VC++

Status
Not open for further replies.

Chillakane

Programmer
Apr 29, 2001
1
NZ
I have a problem where the registry function, RegQueryValueEx, will not return a success on windows 95 and 98 but executes fine on 2000 and NT4.

The error code that is returned is 0 (i.e no error with formatmessage fcn) on 95 and 98, but the strange thing is that the condition I set "if (RegQueryValueEx(etc...) != ERROR_SUCCESS)" is being stepped into. So clearly there is an error!

Here's the type of thing I am doing:

if (RegQueryValueEx(hKey, "", NULL, NULL, (unsigned char *)cValue, (unsigned long *)&lSize)!=ERROR_SUCCESS)...

I want the 'cValue' (path to a particular executable) which works fine in NT4 and 2000. RegOpenKeyEx was called with the KEY_QUERY_ALL mask as required. We have this working fine in VB 6.0 but no luck here.

Help!
 
I just had a similar problem. Check the value returned by RegQueryValueEx. The formatmessage function doesn't work too well with 95/98. The message I received said the operation completed successfully but the error function was being stepped into as well. So I set the RegOpenKeyEx to equal some integer. When I got the value from that, which in my case was '2'. I opened the winerror.h file and looked through until I found my value, 2L. This stated that the path couldn't be found. I had put a slash at the end of my path and it worked in NT but wouldn't work in 95. Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top