| | |
Getting computer name or IP
![]() |
Here's a snippet from some old prog of mine:
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
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
Teme64 @ Windows Developer Blog
•
•
Join Date: Feb 2005
Posts: 43
Reputation:
Solved Threads: 0
•
•
•
•
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.
![]() |
Similar Threads
- Computer Won't Function Properly (Troubleshooting Dead Machines)
- can you hook a computer up to a receiver for surround sound? (Troubleshooting Dead Machines)
- relation of mathematics with computer science (Computer Science)
- How long do you use your computer each day? (Geeks' Lounge)
- computer freeze up when opening a folder (Windows NT / 2000 / XP)
- Can my computer support this?!?!? (Motherboards, CPUs and RAM)
- Computer Club (Geeks' Lounge)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: TreeView HitTest not working
- Next Thread: Confused as to how to return duration in minutes
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age application basic beginner birth bmp calculator cd cells.find click client code college component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report save search sendbyte sites sort sql sql2008 sqlserver subroutine tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows






