DOCERR: Write*ProfileString Declaration Incorrect in API (115328)



The information in this article applies to:

  • Microsoft Visual Basic Professional Edition for Windows 3.0

This article was previously published under Q115328

SUMMARY

This article corrects a WritePrivateProfileString function call documentation error as described in the Windows version 3.1 API Reference help file that shipped with Microsoft Visual Basic version 3.0 for Windows.

MORE INFORMATION

The declaration is incorrectly shown as:
Declare Function WritePrivateProfileString Lib "Kernel"
                                 (ByVal lpApplicationName As String,
                                  lpKeyName As Any,
                                  lpString As Any,
                                  ByVal lplFileName As String) As Integer
				
The correct declaration is as follows:
Declare Function WritePrivateProfileString Lib "Kernel"
                                 (ByVal lpApplicationName As String,
                                  ByVal lpKeyName As Any,
                                  ByVal lpString As Any,
                                  ByVal lplFileName As String) As Integer
				
NOTE: Each Declare statement must be entered as one, single line.

Notice that the "ByVal" keyword was omitted from the second and third parameters in the online reference. [In fact, all of the "PrivateProfile" functions suffer from this omission (missing ByVal in their second argument)]. This means that the function is passing the second (lpKeyName) and third (lpString) by reference. They need to be passed by value.

Modification Type:MinorLast Reviewed:1/8/2003
Keywords:KB115328