Results 1 to 3 of 3

Thread: functions not returning data!

  1. #1

    Thread Starter
    Hyperactive Member Cmdr0Sunburn's Avatar
    Join Date
    May 2001
    Location
    g0t r00t?
    Posts
    461

    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:
    1. Public Function GetSettingString(hKey As Long, strPath As String, strValue As String, Optional Default As String) As String
    2. Dim hCurKey As Long
    3. Dim lValueType As Long
    4. Dim strbuffer As String
    5. Dim lDataBufferSize As Long
    6. Dim intZeroPos As Integer
    7. Dim lRegResult As Long
    8. ' Set up default value
    9. If Not IsEmpty(Default) Then
    10.   GetSettingString = Default
    11. Else
    12.   GetSettingString = ""
    13. End If
    14. ' Open the key and get length of string
    15. lRegResult = RegOpenKey(hKey, strPath, hCurKey)
    16. lRegResult = RegQueryValueEx(hCurKey, strValue, 0&, lValueType, ByVal 0&, lDataBufferSize)
    17. If lRegResult = ERROR_SUCCESS Then
    18.   If lValueType = REG_SZ Then
    19.     ' initialise string buffer and retrieve string
    20.     strbuffer = String(lDataBufferSize, " ")
    21.     lRegResult = RegQueryValueEx(hCurKey, strValue, 0&, 0&, ByVal strbuffer, lDataBufferSize)
    22.     ' format string
    23.     intZeroPos = InStr(strbuffer, Chr$(0))
    24.     If intZeroPos > 0 Then
    25.       GetSettingString = Left$(strbuffer, intZeroPos - 1)
    26.     Else
    27.       GetSettingString = strbuffer
    28.     End If
    29.   End If
    30. Else
    31.   ' there is a problem
    32. End If
    33. lRegResult = RegCloseKey(hCurKey)
    34. 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 {
    }

  2. #2
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    You should only use the IsEmpty function when using variants. Try modifying that.

  3. #3
    Fanatic Member simonm's Avatar
    Join Date
    Sep 2000
    Location
    Devon, England
    Posts
    796
    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
  •  



Click Here to Expand Forum to Full Width