Page 1 of 1
DC_RegQuery
Posted: Wed Sep 05, 2012 1:09 pm
by Wolfgang Ciriack
Hello,
can someone tell me, why DC_RegQuery returns 2, if i query a non existing key ?
(Win7 32bit, eXPress 255)
Re: DC_RegQuery
Posted: Wed Sep 05, 2012 3:08 pm
by Auge_Ohr
hi,
all Value <> 0 return from DllCall meen "fail"
Error Code you will find in Winerror.h
Re: DC_RegQuery
Posted: Sat Sep 08, 2012 12:29 pm
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.
Re: DC_RegQuery
Posted: Sat Sep 08, 2012 6:50 pm
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.
Re: DC_RegQuery
Posted: Sun Sep 09, 2012 12:19 am
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