GetPrivateProfileString Windows API working in migrated code
Make sure INI files and any configuration file used in a migrated application is located in the right location.
[SME100]
Applicationloc =C:\
ExeName=myexe.exeOption Explicit
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 Sub Form_Load()
Dim lngRetVal As Integer
Dim sTemp As String
sTemp = String$(255, 32)
On Error GoTo err
lngRetVal = GetPrivateProfileString("SME100", "ExeName", "", sTemp, Len(sTemp), App.Path + "\sample.ini")
MsgBox sTemp
Exit Sub
err:
MsgBox err.Description
End Sub
How to solve this?
Last updated


