This code snippet retrives the name of your networked computer by using API function.
This code snippet retrives the name of your networked computer by using API function.
API Declarations
Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Rate This code snippet retrives the name of your networked computer by using API function.
(1(1 Vote))
'a label which should be named as label1
Private Sub Form_Load()
'strbuff holds the name of your computer
Dim strbuff As String
Dim n As Long
strbuff = " "
n = 100
'GetComputerName() returns 0 if the function did not execute successfully.
'other wise it returns integet value greater than 0
If (GetComputerName(strbuff, n)) > 0 Then
Label1.Caption = "Network name of my computer is :" + strbuff
End If
End Sub
This code snippet retrives the name of your networked computer by using API function. Comments
No comments yet — be the first to post one!
Post a Comment