Article ID: 105807
Article Last Modified on 12/9/2003
-or-
-or-
'Enter the following Declare statement as one, single line:
Declare Function GetProfileString Lib "Kernel"
(ByVal lpAppName As String, ByVal lpKeyName As String,
ByVal lpDefault As String, ByVal lpReturnedString As String,
ByVal nsize As Integer) As Integer
'NOTE: The GetProfileString function is located in the KERNAL.DLL file,
'which is usually located in the \WINDOWS\SYSTEM directory
dim size, str1 as string
str1 = "" ' To avoid GP fault, initialize with a longer string:
' str1="abcdefghijklmnopqrstuvwxyz"
size = GetProfileString("intl", "sLongDate", "-1", str1, 1024)
The above API function looks in the WIN.INI file under the [intl]
section and retrieves the string after sLongDate=. The function returns
a string in the address of its fourth argument. If you fail to define
the fourth argument or you initialize it to a string that is smaller
than the retrieved string, an assertion error occurs. If you define the
fourth argument with a string that is larger than the retrieved string,
the call will succeed. For example, change the line str1="" to
str1="abcdefghijklmnopqrstuvwxyz" and the code will work.Additional query words: 2.00 3.00 GPF
Keywords: kbprb KB105807