|
-
Apr 20th, 2001, 10:48 AM
#1
Thread Starter
Addicted Member
I am having trouble retrieving from an ini. I only get a blank string. Any help would be appreciated!
Here's my code:
Public Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
buffer = String(145, " ")
rc = GetPrivateProfileString("test", "test", "default", buffer, Len(buffer) - 1, "D:\test.ini")
retstring = Left(buffer, InStr(buffer, " ") - 1)
-
Apr 20th, 2001, 11:26 AM
#2
Change this line:
retstring = Left(buffer, InStr(buffer, " ") - 1)
to this line:
retstring = Left(buffer, InStr(buffer, Chr(0)) - 1)
-
Apr 20th, 2001, 11:31 AM
#3
Thread Starter
Addicted Member
That's how I started. I get an "invalid procedure call or argument" error on that line when it runs. Any other ideas?
-
Apr 20th, 2001, 12:27 PM
#4
Make sure you declared buffer as a string:
Dim buffer As String
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
|