Public Function fGetstring1(HKey As Long, strPath As String, strValue As String)
Dim keyhand As Long
Dim datatype As Long
Dim lResult As Long
Dim strBuf As String
Dim lDataBufSize As Long
Dim intZeroPos As Integer
'Open it
r = RegOpenKey(HKey, strPath, keyhand)
'Query the registry
lResult = RegQueryValueEx(keyhand, strValue, 0&, lValueType, ByVal 0&, lDataBufSize)
If lValueType = REG_SZ Then
strBuf = String(lDataBufSize, " ")
lResult = RegQueryValueEx(keyhand, strValue, 0&, 0&, ByVal strBuf, lDataBufSize)
If lResult = ERROR_SUCCESS Then
intZeroPos = InStr(strBuf, Chr$(0))
If intZeroPos > 0 Then
fGetstring = Left$(strBuf, intZeroPos - 1)
Else
fGetstring = strBuf
End If
End If
End If
End Function
Private Sub Form_Load()
Dim Contex As String
Contex = fGetstring1(HKEY_LOCAL_MACHINE, "Novell","Location", "Profiles","Services","{1E6CEEA1-FB73-11CF-BD76-00001B27DA23}","Default","Tab1")
Label10 = Contex
End Sub
Please rate this post if it was useful for you!
Please try to search before creating a new post,
Please format code using [ code ][ /code ], and
Post sample code, error details & problem details