Understanding an API Declaration

The following line is an example of an API function:

Private Declare Function GetUserName _

Lib "advapi32.dll" Alias "GetUserNameA" _ (ByVal lpBuffer As String, nSize As Long) As Long

There are two types of API declarations: functions, which return information, and procedures, which do something to the system. The declarations are structured similarly.

Basically, what this declaration is saying is

■ It's Private, meaning it can only be used in the module in which it is declared. Declare it Public in a standard module if you want to share it among several modules.

0 0

Post a comment