is this what you need?
VB Code:
Private Declare Function GetComName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long Private Sub Command1_Click() Dim com_name As String Dim length As Long com_name = Space$(256) length = Len(com_name) GetComName com_name, length com_name = Left$(com_name, length) MsgBox "[" & com_name & "]" End Sub





Reply With Quote