I am using GetPrivateProfileString to read an ini file, this works great on my Win2k machine but not my WinME system. Please help
Printable View
I am using GetPrivateProfileString to read an ini file, this works great on my Win2k machine but not my WinME system. Please help
Hmm, you really need to paste the code you are using for this one. See if the code below works:
VB Code:
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 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 Private Sub Form_Load() Dim Ret As String, NC As Long WritePrivateProfileString App.Title, "KeyName", "This is the value", "c:\test.ini" Ret = String(255, 0) NC = GetPrivateProfileString(App.Title, "KeyName", "Default", Ret, 255, "C:\test.ini") If NC <> 0 Then Ret = Left$(Ret, NC) MsgBox Ret Kill "c:\test.ini" End Sub