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

Recommended Answers

All 3 Replies

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

Private Declare Function GetComputerName Lib "kernel32" Alias _
  "GetComputerNameA" (ByVal lpBuffer As String, ByRef nSize As Long) As Long

Public Function GetThisComputerName(ByRef ComputerName As String) As Boolean
' Returns Computer name
Dim lpBuffer As String
Dim i As Long

  Const BUFMAXLENGTH = 256
  ComputerName = ""
  GetThisComputerName = False
  lpBuffer = Space$(BUFMAXLENGTH)
  i = BUFMAXLENGTH
  i = GetComputerName(lpBuffer, i)
  If i > 0 Then
    i = InStr(lpBuffer, Chr(0))
    ComputerName = Left$(lpBuffer, i - 1)
    GetThisComputerName = True
  End If

End Function

use this for system IP

msgbox winsock1.LocalIP

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.