Results 1 to 2 of 2

Thread: GetPrivateProfileString

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2001
    Posts
    21

    GetPrivateProfileString

    When I try to read settings from an INI file using GetPrivateProfileString, my program crashes with this error message:



    Code:
    GetPrivateProfileString "default", "name", "(error)", s, 15, App.Path & "\sheepkill.ini"

    What could be wrong?

  2. #2
    Fanatic Member Patoooey's Avatar
    Join Date
    Aug 2001
    Location
    New Jersey, USA
    Posts
    774
    Try this....I never use INI files.....all the samples I have use 255 for the length of the variable to hold the value.

    VB Code:
    1. s = String(255, 0)
    2. x = GetPrivateProfileString("Default", "Name", "Default", s, 255, App.Path & "\sheepkill.ini" )
    3.  
    4. If x <> 0 Then
    5.    s = Left$(s, x)
    6. End If
    7.  
    8. MsgBox s

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