Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Private Sub Command1_Click()
Dim NameOfPC As String
NameOfPC = GetComputer
MsgBox "Bilgisaya Adı = " + NameOfPC
End Sub
Function GetComputer() As String
Dim X As Long
Dim PCName As String * 255
PCName = Space(255)
X = GetComputerName(PCName, 255&)
GetComputer = Left$(PCName, InStr(PCName, vbNullChar) - 1)
End Function