CitectVBA Programming Reference > Understanding CitectVBA Language Basics > DLLs and APIs > Declare - Alias Statement
Declare - Alias Statement

In the previous Declare statement example, the name of the declared function in CitectVBA is the same as the name of the actual function within the DLL. This does not necessarily have to be the case. There are some instances where the name of the function in the DLL is incompatible with the naming structure of CitectVBA, and cannot be used as a declared function name in CitectVBA. An example would be those DLL function names that start with an underscore.

To overcome such incompatibilities, the CitectVBA Declare statement supports the use of an alias name for the DLL function, through the use of the optional Alias statement . The Alias statement consists of the Alias keyword, followed by the actual name of the DLL function contained within string double quotes. The Alias statement must be positioned within the Declare statement between the Lib statement and the Argument statement.

Here's an example of the Declare statement for the Windows API GetTempPathA function as used above, however, this time using the optional Alias statement:

Declare Function GetWinTempPath Lib "kernel32" _
(Byval nBufferLength As Long, _ Alias "GetTempPathA" _
Byval lpBuffer As String) As Long

In this example, the name of the API function in the DLL is GetTempPathA, and the name by which you would call this function from CitectVBA is GetWinTempPath. Note that the actual name of the DLL function appears contained within string double quotes positioned after the Alias keyword. This instructs CitectVBA to use the alias function name when calling the DLL.

Because an alias allows you to name a declared DLL function anything you want in CitectVBA, you can make the function name conform to your own naming standards.

Note: DLL functions are case sensitive; CitectVBA function names are not. When declaring DLL functions in CitectVBA, be careful to accurately remain case sensitive in the declaration.

See Also

Functions

Passing variables Byref and Byval

Passing Arguments to DLL Functions from CitectVBA

DLLs and APIs