# Re: 如何取得win95使用者的姓名

Posted by SATURNBOY on June 29, 1997 at 12:09:59:

In Reply to: 如何取得win95使用者的姓名 posted by 蔡庆廷 on June 28, 1997 at 18:24:18:

: 如何取得win95使用者的姓名...

使用GetUserName 这个WIN32 API.

Declaration:
Declare Function GetUserName& Lib "advapi32" Alias _
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) _
As Long

Example:
Dim UserName As String , Rtval As Long
UserName = Space$(20)

Rtval = GetUserName(UserName, 20)
'UserName的值, 就是使用者的姓名了.

Follow Ups: