How can I grab the computer name? As in the name Netbios would give the system.
Printable View
How can I grab the computer name? As in the name Netbios would give the system.
copy paste the code in a new application
option Explicit
private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (byval lpBuffer as string, nSize as Long) as Long
private Sub Command1_Click()
Dim ret as Long
Dim buff as string
buff = Space(255)
ret = GetComputerName(buff, 255)
MsgBox buff
End Sub
Use API's:
For instance toget computer name
use GetComputerName function.
Similarly if want to get hold of the current user name then use API
GetUserName.
Use VB Application wizard to get to see how to use these calls as the wizard
automatically generates the code for you.