?
Solved

computer name

Posted on 2003-02-19
5
Medium Priority
?
194 Views
Last Modified: 2013-11-13
Hi,
Can u tell me how i can read computer name in VB6. fazi
0
Comment
Question by:mfazi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 

Expert Comment

by:StonedRaider
ID: 7985834
use GetComputerName API function
0
 
LVL 53

Accepted Solution

by:
Dhaest earned 120 total points
ID: 7985853
2 possibilities:

  MsgBox Environ$("computername")

(see http://www.developerfusion.com/show/1640/show.aspx for more information)

or

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
0
 

Expert Comment

by:freeman200
ID: 7985989
Add a Winsock component.

MsgBox Winsock1.LocalHostName

Thats it...
0
 

Expert Comment

by:CleanupPing
ID: 8901404
mfazi:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Experts: Post your closing recommendations!  Who deserves points here?
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 8963843
Moderator, my recommended disposition is:

    Accept Dhaest's comment(s) as an answer.

DanRollins -- EE database cleanup volunteer
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Having just graduated from college and entered the workforce, I don’t find myself always using the tools and programs I grew accustomed to over the past four years. However, there is one program I continually find myself reverting back to…R.   So …
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question