Alias Clause (Visual Basic)
Indicates that an external procedure has another name in its DLL.
Remarks
The Alias
keyword can be used in this context:
In the following example, the Alias
keyword is used to provide the name of the function in advapi32.dll, GetUserNameA
, that getUserName
is used in place of in this example. Function getUserName
is called in sub getUser
, which displays the name of the current user.
Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (
ByVal lpBuffer As String, ByRef nSize As Integer) As Integer
Sub GetUser()
Dim buffer As String = New String(CChar(" "), 25)
Dim retVal As Integer = GetUserName(buffer, 25)
Dim userName As String = Strings.Left(buffer, InStr(buffer, Chr(0)) - 1)
MsgBox(userName)
End Sub
See also
Співпраця з нами на GitHub
Джерело цього вмісту можна знайти на GitHub, де також можна створювати й переглядати запитання та запити на внесення змін. Докладні відомості наведено в нашому посібнику для співавторів.
Зворотний зв’язок
https://aka.ms/ContentUserFeedback.
Очікується незабаром: протягом 2024 року ми будемо припиняти використання механізму реєстрації проблем у GitHub для зворотного зв’язку щодо вмісту й замінювати його новою системою зворотного зв’язку. Докладніше:Надіслати й переглянути відгук про