by Yeolekar Nitin Padmakar - EBG India Pvt Ltd (1 Submission)
Category: Windows API Call/Explanation
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Wed 9th January 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)
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
'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
No comments have been posted about This code snippet retrives the name of your networked computer by using API function.. Why not be the first to post a comment about This code snippet retrives the name of your networked computer by using API function..