OrthoDocSoft
Programmer
I have a VB6 application which is developed on Windows Me that works just fine. Below are the API functions:
************
Public Declare Function RegCreateKey Lib "advapi32.dll" _
Alias "RegCreateKeyA" (ByVal hKey As Long, _
ByVal lpSubKey As String, phkResult _
As Long) As Long
Public Declare Function RegDeleteKey Lib "advapi32.dll" _
Alias "RegDeleteKeyA" (ByVal hKey As Long, _
ByVal lpSubKey As String) As Long
Public Declare Function RegDeleteValue Lib "advapi32.dll" _
Alias "RegDeleteValueA" (ByVal hKey As Long, _
ByVal lpValueName As String) As Long
Public Declare Function RegQueryValueEx Lib "advapi32.dll" _
Alias "RegQueryValueExA" (ByVal hKey As Long, _
ByVal lpValueName As String, ByVal lpReserved As Long, _
lpType As Long, lpData As Any, lpcbData As Long) As Long
Public Declare Function RegSetValueEx Lib "advapi32.dll" _
Alias "RegSetValueExA" (ByVal hKey As Long, _
ByVal lpValueName As String, ByVal Reserved As Long, _
ByVal dwType As Long, lpData As Any, _
ByVal cbData As Long) As Long
*****************
My code goes like this:
*****************
retValue = RegCreateKey(HKEY_LOCAL_MACHINE, regKey, keyID)
retValue = RegCreateKey(HKEY_LOCAL_MACHINE, regKey2, keyID2)
If retValue = 0 Then
(Do somthing)
*****************
Problem is, that API call does not work WHEN RUNNING ON WINDOWS XP (retValue = 161 instead of 0 -- which it should be if successful). It works just fine on Windows Me. I suspect that there is an updated API that I should use instead of RegCreateKey.
Any help would be much appreciated.
Also any recommendations for books on API functions with windows XP would be met with gratitude.
Ortho
************
Public Declare Function RegCreateKey Lib "advapi32.dll" _
Alias "RegCreateKeyA" (ByVal hKey As Long, _
ByVal lpSubKey As String, phkResult _
As Long) As Long
Public Declare Function RegDeleteKey Lib "advapi32.dll" _
Alias "RegDeleteKeyA" (ByVal hKey As Long, _
ByVal lpSubKey As String) As Long
Public Declare Function RegDeleteValue Lib "advapi32.dll" _
Alias "RegDeleteValueA" (ByVal hKey As Long, _
ByVal lpValueName As String) As Long
Public Declare Function RegQueryValueEx Lib "advapi32.dll" _
Alias "RegQueryValueExA" (ByVal hKey As Long, _
ByVal lpValueName As String, ByVal lpReserved As Long, _
lpType As Long, lpData As Any, lpcbData As Long) As Long
Public Declare Function RegSetValueEx Lib "advapi32.dll" _
Alias "RegSetValueExA" (ByVal hKey As Long, _
ByVal lpValueName As String, ByVal Reserved As Long, _
ByVal dwType As Long, lpData As Any, _
ByVal cbData As Long) As Long
*****************
My code goes like this:
*****************
retValue = RegCreateKey(HKEY_LOCAL_MACHINE, regKey, keyID)
retValue = RegCreateKey(HKEY_LOCAL_MACHINE, regKey2, keyID2)
If retValue = 0 Then
(Do somthing)
*****************
Problem is, that API call does not work WHEN RUNNING ON WINDOWS XP (retValue = 161 instead of 0 -- which it should be if successful). It works just fine on Windows Me. I suspect that there is an updated API that I should use instead of RegCreateKey.
Any help would be much appreciated.
Also any recommendations for books on API functions with windows XP would be met with gratitude.
Ortho