Hi
How we can get Computer Name
Thanks
Printable View
Hi
How we can get Computer Name
Thanks
Don't forget to mark this thread :check: Resolved if you're done!Code:Private Declare Function GetComputerNameW Lib "kernel32.dll" (ByVal lpBuffer As Long, ByRef lpnSize As Long) As Long
Public Function GetComputerName() As String
Const MAX_COMPUTERNAME_LENGTH = 31&
Dim nSize As Long, sBuffer As String
nSize = MAX_COMPUTERNAME_LENGTH
sBuffer = Space$(nSize)
If GetComputerNameW(StrPtr(sBuffer), nSize) Then GetComputerName = Left$(sBuffer, nSize)
End Function
Also...
You could use vb6 Environ function
Code:'displays Computer name
MsgBox Environ("ComputerName")