I am using the API RegQueryValueEx to determine what diectory a user installed my program in. The Variable 'strValue' gets a byref compile error
I have defined the variable strvalue as a string and as a byte array neither worked.
Here is the code:
LocationOfProgram = GetProgramPath(HKEY_LOcal_machine, "Software\Microsoft\Windows\CurrentVersion\App Paths")
Private Function GetProgramPath(ByVal RootKey As HKEYS, ByVal sKey As String) As String
Dim hKeyHandle As Long
Dim ReturnCode As Long
Dim strValue() As Byte
Dim lngDataLen As Long
ReturnCode = RegOpenKeyEx(RootKey, sKey, 0&, lngKEY_ALL_ACCESS, hKeyHandle)
If ReturnCode = ERROR_SUCCESS Then
ReDim strValue(2000)
lngDataLen = 2000
ReturnCode = RegQueryValueEx(hKeyHandle, "ghostexp.exe", "Path", 0&, REG_SZ, strValue, lngDataLen)
End If
Call RegCloseKey(hKeyHandle)
End Function
I have defined the variable strvalue as a string and as a byte array neither worked.
Here is the code:
LocationOfProgram = GetProgramPath(HKEY_LOcal_machine, "Software\Microsoft\Windows\CurrentVersion\App Paths")
Private Function GetProgramPath(ByVal RootKey As HKEYS, ByVal sKey As String) As String
Dim hKeyHandle As Long
Dim ReturnCode As Long
Dim strValue() As Byte
Dim lngDataLen As Long
ReturnCode = RegOpenKeyEx(RootKey, sKey, 0&, lngKEY_ALL_ACCESS, hKeyHandle)
If ReturnCode = ERROR_SUCCESS Then
ReDim strValue(2000)
lngDataLen = 2000
ReturnCode = RegQueryValueEx(hKeyHandle, "ghostexp.exe", "Path", 0&, REG_SZ, strValue, lngDataLen)
End If
Call RegCloseKey(hKeyHandle)
End Function