ok i have some code in a dll and when i call it it nothing happens, i mean it should return the data but its not, i can put thesame code in the exe and it works fine.
VB Code:
Public Function GetSettingString(hKey As Long, strPath As String, strValue As String, Optional Default As String) As String Dim hCurKey As Long Dim lValueType As Long Dim strbuffer As String Dim lDataBufferSize As Long Dim intZeroPos As Integer Dim lRegResult As Long ' Set up default value If Not IsEmpty(Default) Then GetSettingString = Default Else GetSettingString = "" End If ' Open the key and get length of string lRegResult = RegOpenKey(hKey, strPath, hCurKey) lRegResult = RegQueryValueEx(hCurKey, strValue, 0&, lValueType, ByVal 0&, lDataBufferSize) If lRegResult = ERROR_SUCCESS Then If lValueType = REG_SZ Then ' initialise string buffer and retrieve string strbuffer = String(lDataBufferSize, " ") lRegResult = RegQueryValueEx(hCurKey, strValue, 0&, 0&, ByVal strbuffer, lDataBufferSize) ' format string intZeroPos = InStr(strbuffer, Chr$(0)) If intZeroPos > 0 Then GetSettingString = Left$(strbuffer, intZeroPos - 1) Else GetSettingString = strbuffer End If End If Else ' there is a problem End If lRegResult = RegCloseKey(hCurKey) End Function




Reply With Quote