RegOpenKeyEx(HKey, sKey, 0, KEY_READ, k)
Hi! I use advapi32.dll and function lRet = RegOpenKeyEx(HKey_, sKey, 0,
KEY_READ, k) for working in my register. In VB6 it work correctly, but
in vb.net lRet = 5611065534578775. All parameters in vb6 and vb.net are
the same.What's my mistake? Or where can I see the error description?
AndreyPosted Sep 17, 2008, 3:07 AM
AlanPosted Sep 16, 2008, 12:21 PM
This is the suggested signature for calling that API function from VB.Net which I've taken from the P/Invoke.Net website:
Declare Auto Function RegOpenKeyEx Lib "advapi32.dll" (
ByVal hKey As IntPtr,
ByVal lpSubKey As String,
ByVal ulOptions As Integer,
ByVal samDesired As Integer,
ByRef phkResult As Integer
) As Integer
The most likely reason that you're having a problem is that the parameters and return type which had the Long type in VB6 will now require the Integer type in VB.Net. This is because Integer and Long were 2 and 4 byte integers in VB6 but are, respectively, 4 and 8 byte integers in VB.Net.