DC_RegQuery

This forum is for eXpress++ general support.
Post Reply
Message
Author
Wolfgang Ciriack
Posts: 484
Joined: Wed Jan 27, 2010 10:25 pm
Location: Berlin Germany

DC_RegQuery

#1 Post by Wolfgang Ciriack »

Hello,
can someone tell me, why DC_RegQuery returns 2, if i query a non existing key ?
(Win7 32bit, eXPress 255)
_______________________
Best Regards
Wolfgang

User avatar
Auge_Ohr
Posts: 1428
Joined: Wed Feb 24, 2010 3:44 pm

Re: DC_RegQuery

#2 Post by Auge_Ohr »

hi,

all Value <> 0 return from DllCall meen "fail"
Error Code you will find in Winerror.h
greetings by OHR
Jimmy

Wolfgang Ciriack
Posts: 484
Joined: Wed Jan 27, 2010 10:25 pm
Location: Berlin Germany

Re: DC_RegQuery

#3 Post by Wolfgang Ciriack »

Hi Roger,
does DC_RegQuery only returns strings, so if it returns a numeric, it is the error code from the DLL call ?
I thought, that if the key does not exists, DC_RegQuery returns an empty string.
If so, please correct the docs.
_______________________
Best Regards
Wolfgang

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: DC_RegQuery

#4 Post by rdonnay »

DC_RegQuery() makes a Windows API call that returns an ambiguous value.

I have always wondered how to deal with this problem.

If the value stored is a numeric value of 2, then the returned value is also 2, which is ambiguous.
The eXpress train is coming - and it has more cars.

Wolfgang Ciriack
Posts: 484
Joined: Wed Jan 27, 2010 10:25 pm
Location: Berlin Germany

Re: DC_RegQuery

#5 Post by Wolfgang Ciriack »

Hi Roger,
i think a first step can be to put an "else" in this function, so in the case the Reg Key does not exists, the function returns an empty string:

Code: Select all

   xValue := DllCall( nDllHandle, DLL_STDCALL, "RegOpenKeyExA", nHKey, @cSubKey, ;
               0, nKey, @nKeyHandle) // = 0

   IF xValue == 0
       ................
       ................
   ELSE
      xValue:=""
  ENDIF
_______________________
Best Regards
Wolfgang

Post Reply