|
-
Aug 14th, 2003, 09:56 AM
#1
Thread Starter
Fanatic Member
Computer Name [Resolved]
Does anyone know how to get the computer name off the current machine? I will need to be able to do this on Win 98, 2000, and XP if the method is different for each one.
Last edited by Maldrid; Aug 14th, 2003 at 10:13 AM.
Motto: Anything for a laugh.
Getting second place only means you are the first loser to cross the finish line.
-
Aug 14th, 2003, 09:59 AM
#2
Via the AllApi.Net guide
says it works on 95 and up
VB Code:
Private Const MAX_COMPUTERNAME_LENGTH As Long = 31
Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Private Sub Form_Load()
Dim dwLen As Long
Dim strString As String
'Create a buffer
dwLen = MAX_COMPUTERNAME_LENGTH + 1
strString = String(dwLen, "X")
'Get the computer name
GetComputerName strString, dwLen
'get only the actual data
strString = Left(strString, dwLen)
'Show the computer name
MsgBox strString
End Sub
-
Aug 14th, 2003, 09:59 AM
#3
Frenzied Member
Ther codebank forum has a good example of this. Try a search there - this post has been answered 60+ times in the past year.
-
Aug 14th, 2003, 10:08 AM
#4
Thread Starter
Fanatic Member
Yea I tried doing a search for Computer Name, but then I get every post that has computer in it. Do you know how many posts that is?
Motto: Anything for a laugh.
Getting second place only means you are the first loser to cross the finish line.
-
Aug 14th, 2003, 10:13 AM
#5
Thread Starter
Fanatic Member
Thanks kleinma. I should of checked the API guide myself hehe, but my first instincts is to always go here.
Motto: Anything for a laugh.
Getting second place only means you are the first loser to cross the finish line.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|