Getting computer name or IP

Reply

Join Date: Jul 2008
Posts: 53
Reputation: pardeep3dec is an unknown quantity at this point 
Solved Threads: 1
pardeep3dec pardeep3dec is offline Offline
Junior Poster in Training

Getting computer name or IP

 
0
  #1
Oct 11th, 2008
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
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 710
Reputation: Teme64 will become famous soon enough Teme64 will become famous soon enough 
Solved Threads: 114
Teme64's Avatar
Teme64 Teme64 is offline Offline
Master Poster

Re: Getting computer name or IP

 
0
  #2
Oct 11th, 2008
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
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 2,094
Reputation: debasisdas will become famous soon enough debasisdas will become famous soon enough 
Solved Threads: 128
debasisdas's Avatar
debasisdas debasisdas is offline Offline
Postaholic

Re: Getting computer name or IP

 
0
  #3
Oct 14th, 2008
use this for system IP

msgbox winsock1.LocalIP
Share your Knowledge.
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 43
Reputation: Phreak is an unknown quantity at this point 
Solved Threads: 0
Phreak Phreak is offline Offline
Light Poster

Re: Getting computer name or IP

 
0
  #4
Oct 14th, 2008
Originally Posted by pardeep3dec View 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

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.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC