Hi,
I´m reading some information from a INI file. I´m using this declare:
Declare Function GetPrivateProfileSection Lib "kernel32" Alias "GetPrivateProfileSectionA" (ByVal lpAppName As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
Then I make:
Dim lcl_strini As String
Dim nc As Long
nc = GetPrivateProfileString("est", "DataSource", "Default", lcl_strini, 255, App.Path & "\initapp.ini"
The problem is that when I use it, my vb crashes! To solve the problem, I needed to define the lcl_strini variable with a fixed length! Like: Dim lcl_strini as string * 100 (for instance)
Why does I need to declare a variable in that way? Why can´t it be a nor mal string?
Then, another problem that arises is that my return string will have a lot of junk inside it... How can I take it away?
Thank you in advance,
Sergio Oliveira
I´m reading some information from a INI file. I´m using this declare:
Declare Function GetPrivateProfileSection Lib "kernel32" Alias "GetPrivateProfileSectionA" (ByVal lpAppName As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
Then I make:
Dim lcl_strini As String
Dim nc As Long
nc = GetPrivateProfileString("est", "DataSource", "Default", lcl_strini, 255, App.Path & "\initapp.ini"
The problem is that when I use it, my vb crashes! To solve the problem, I needed to define the lcl_strini variable with a fixed length! Like: Dim lcl_strini as string * 100 (for instance)
Why does I need to declare a variable in that way? Why can´t it be a nor mal string?
Then, another problem that arises is that my return string will have a lot of junk inside it... How can I take it away?
Thank you in advance,
Sergio Oliveira