>> > retVal = RegOpenKeyEx(HKEY_LOCAL_MACHINE,subKey,0,KEY_READ,&OpenKey);
> retVal is declared as a long, subKey is a char [46], and OpenKey is
> HKEY. I don't think these have anything to do with it, from what I can
> tell it has to do with HKEY_LOCAL_MACHINE being a constant with an int
> value, and needing to be of type "HKEY". Any ideas?
If that is the case, then you can solve the problem with a simple explicit
typecast i think.
(INT_PTR)HKEY_LOCAL_MACHINE
Are you doing this on x64 perhaps?
Because otherwise a handle should be the same size as a DWORD on x386,
unless I am missing something obvious.

Signature
Kind regards,
Bruno van Dooren
bruno_nos_pam_van_dooren@hotmail.com
Remove only "_nos_pam"
Jay - 31 Oct 2006 19:38 GMT
> >> > retVal = RegOpenKeyEx(HKEY_LOCAL_MACHINE,subKey,0,KEY_READ,&OpenKey);
>
[quoted text clipped - 17 lines]
> bruno_nos_pam_van_dooren@hotmail.com
> Remove only "_nos_pam"
Thanks for the input, but when I set the line to:
retVal =
RegOpenKeyEx((INT_PTR)HKEY_LOCAL_MACHINE,subKey,0,KEY_READ,&OpenKey);
I just get the error:
error C2664: 'RegOpenKeyExA' : cannot convert parameter 1 from
'INT_PTR' to 'HKEY'
Conversion from integral type to pointer type requires
reinterpret_cast, C-style cast or function-style cast
Is there something else I should do?
-Jay
(patelj27b at gmail dot com)
Bruno van Dooren [MVP VC++] - 01 Nov 2006 09:30 GMT
> Thanks for the input, but when I set the line to:
> retVal =
[quoted text clipped - 7 lines]
>
> Is there something else I should do?
D'oh.
That what you get when posting with a head full of snot.
Of course I meant
(HKEY)HKEY_LOCAL_MACHINE
But I just checked that constant, and it is defined like this:
(( HKEY ) (ULONG_PTR)((LONG)0x80000002) )
So I don't think the parameter is the problem.
To be sure, I just compiled this with /W4, and got no warnings.
char subKey[] = "test";
HKEY OpenKey;
DWORD retVal =
RegOpenKeyExA(HKEY_LOCAL_MACHINE,subKey,0,KEY_READ,&OpenKey);
What version of VC++ are you using, and are you really sure that retVal is a
DWORD?

Signature
Kind regards,
Bruno van Dooren
bruno_nos_pam_van_dooren@hotmail.com
Remove only "_nos_pam"
Jay - 01 Nov 2006 15:56 GMT
> > Thanks for the input, but when I set the line to:
> > retVal =
[quoted text clipped - 32 lines]
> bruno_nos_pam_van_dooren@hotmail.com
> Remove only "_nos_pam"
Mr. Van Dooren,
I am currently using Visual Studio 2003
-Jay
(patelj27b at gmail dot com)