VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



This code snippet retrives the name of your networked computer by using API function.

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

Rate This code snippet retrives the name of your networked computer by using API function.



'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





Download this snippet    Add to My Saved Code

This code snippet retrives the name of your networked computer by using API function. Comments

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..

Post your comment

Subject:
Message:
0/1000 characters