I’m trying to convert a VB program from Visual studio 6 to Visual Studio 2008. I have the following declaration and function
Declare Unicode Function _
GetPrivateProfileStringW Lib “kernel32” _ Alias “GetPrivateProfileStringW” ( _
ByVal lpApplicationName As String, _
ByVal lpKeyName As String, _
ByVal lpDefault As String, _
ByVal lpReturnedString As String, _
ByVal nSize As Long, _
ByVal lpFileName As String) As Long
Public Function qcuGetProfileString( _
ByVal sSectionName As String, _
ByVal sKeyName As String, _
ByVal sDefault As String, _
ByVal sFileName As String) As String
Dim sReturn As String = “”
Dim lSize As Long = 256
Dim lRC As Long
lRC = GetPrivateProfileStringW(sSectionName, _ sKeyName, sDefault, _sReturn, lSize, sFileName)
qcuGetProfileString = sReturn
End Function
When I debug lRC is a huge number and sReturn is Nothing or an empty string, or (sometimes “;”)
I can’t see what is wrong.
Can anyone help?