标题: [求助]ACCESS里怎样知道自己的计算机名字 [打印本页] 作者: superjinyu 时间: 2006-7-8 04:45 标题: [求助]ACCESS里怎样知道自己的计算机名字 RT作者: andymark 时间: 2006-7-8 05:01
Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Public Function ComputerName()
Dim a As String * 40
Dim nSize As Long
nSize = 40
Call GetComputerName(a, nSize)
ComputerName = StrZ(a)
End Function
Private Function StrZ(par As String) As String
Dim nSize As Long, i As Long, Rez As String
nSize = Len(par)
i = InStr(1, par, Chr(0)) - 1
If i > nSize Then i = nSize
If i < 0 Then i = nSize
StrZ = Mid(par, 1, i)
End Function
Private Sub Form_Load()
MsgBox ComputerName()
End Sub