943,920 Members | Top Members by Rank

Ad:
Oct 11th, 2008
0

Getting computer name or IP

Expand Post »
Hi friends,
I need a programme or procedure which is capable in generating IP or computer name of the system( on which programme is running).

Thank you
Similar Threads
Reputation Points: 10
Solved Threads: 1
Junior Poster in Training
pardeep3dec is offline Offline
87 posts
since Jul 2008
Oct 11th, 2008
0

Re: Getting computer name or IP

Here's a snippet from some old prog of mine:

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Private Declare Function GetComputerName Lib "kernel32" Alias _
  2. "GetComputerNameA" (ByVal lpBuffer As String, ByRef nSize As Long) As Long
  3.  
  4. Public Function GetThisComputerName(ByRef ComputerName As String) As Boolean
  5. ' Returns Computer name
  6. Dim lpBuffer As String
  7. Dim i As Long
  8.  
  9. Const BUFMAXLENGTH = 256
  10. ComputerName = ""
  11. GetThisComputerName = False
  12. lpBuffer = Space$(BUFMAXLENGTH)
  13. i = BUFMAXLENGTH
  14. i = GetComputerName(lpBuffer, i)
  15. If i > 0 Then
  16. i = InStr(lpBuffer, Chr(0))
  17. ComputerName = Left$(lpBuffer, i - 1)
  18. GetThisComputerName = True
  19. End If
  20.  
  21. End Function
Reputation Points: 218
Solved Threads: 201
Veteran Poster
Teme64 is offline Offline
1,024 posts
since Aug 2008
Oct 14th, 2008
0

Re: Getting computer name or IP

use this for system IP

msgbox winsock1.LocalIP
Featured Poster
Reputation Points: 665
Solved Threads: 427
Posting Genius
debasisdas is offline Offline
6,406 posts
since Feb 2007
Oct 14th, 2008
0

Re: Getting computer name or IP

Hi friends,
I need a programme or procedure which is capable in generating IP or computer name of the system( on which programme is running).

Thank you

Hi,

Has this been resolved or are you still looking? I have a very quick and easy 3 line tiny piece of code i used ages ago that will give you exactly what you need (PC name)... Then you can edit it to your hearts content to give you usernames etc as well...

if you still require it let me know and ill pop it in here for ya... :-)

Edit***
I've just re-read that... do you mean you want a program to create a PC name on the PC in which the app is ran ... or to greturn the pc name of the pc your running the app on?

Your post can be read both ways... :-)
My little line of code will give you the name of a pc you run it on, and/or the username of the users logged in etc... i found it very hand when i uneeded it a few years ago for back up purposes.

Phreak
Last edited by Phreak; Oct 14th, 2008 at 5:16 pm.
Reputation Points: 10
Solved Threads: 0
Light Poster
Phreak is offline Offline
43 posts
since Feb 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: TreeView HitTest not working
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Confused as to how to return duration in minutes





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC