Results 1 to 2 of 2

Thread: GetPrivateProfileString

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2001
    Location
    Worcester, MA
    Posts
    77

    Question GetPrivateProfileString

    I am using GetPrivateProfileString to read an ini file, this works great on my Win2k machine but not my WinME system. Please help
    "Find all you need in your mind if you take the time" -DT

  2. #2
    Member VbAndersonic's Avatar
    Join Date
    Aug 2001
    Location
    Derby, UK
    Posts
    58
    Hmm, you really need to paste the code you are using for this one. See if the code below works:

    VB Code:
    1. Private 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
    2. Private Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long
    3. Private Sub Form_Load()
    4.     Dim Ret As String, NC As Long
    5.     WritePrivateProfileString App.Title, "KeyName", "This is the value", "c:\test.ini"
    6.     Ret = String(255, 0)
    7.     NC = GetPrivateProfileString(App.Title, "KeyName", "Default", Ret, 255, "C:\test.ini")
    8.     If NC <> 0 Then Ret = Left$(Ret, NC)
    9.     MsgBox Ret
    10.     Kill "c:\test.ini"
    11. End Sub

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