VB获取当前系统的用户名

来源:百度知道 编辑:UC知道 时间:2024/06/27 11:10:46
VB获取当前系统的用户名

让text1.text显示

Public Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long

Dim StrT As String * 255
GetComputerName StrT, 255

strt里面存放在计算机的名字

很简单。

Text1.Text = Environ("username")