利用VB代码:
Public Declare Function GetComputerName Lib "kernel32" Alias
"GetComputerNameA" (ByVal sBuffer As String, lSize As Long) As Long
Function NameOfPC(MachineName As String) As Long
Dim NameSize As Long
Dim X As Long
MachineName = Space$(255)
NameSize = Len(MachineName)
X = GetComputerName(MachineName, NameSize)
End Function
在你的程序中可以简单的调用这个FUNCTION就可以了!