|
-
Feb 3rd, 2002, 08:44 PM
#1
Thread Starter
Hyperactive Member
functions not returning data!
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
I know a lot oF Vb, expert in C++, and i think in assembly.
MSVC++6.NET
vb6
masm
Windowz Xp
I find my self using this a lot in C++
__asm {
}
-
Feb 4th, 2002, 08:22 PM
#2
PowerPoster
You should only use the IsEmpty function when using variants. Try modifying that.
-
Feb 5th, 2002, 09:36 AM
#3
Fanatic Member
Also, try stepping through it.
Add your DLL project to your Client EXE project, step though it and see what happens.
Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment. 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|