Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get PC Name

Status
Not open for further replies.

gnosis13

Programmer
Jul 13, 2001
263
US
I am appending a line to a log file in an on_click event of a button. I would like to capture the PC's network name either during form_activate or at the on_click and include it as part of the string written to the log. How can I get the PC name without a bunch of API calls? (trying to keep it simple) A+, N+, MCP
 
Here is an API

Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal sBuffer As String, lSize As Long) As Long
 
How would I access this API from the on_click event? For example:

dim computer_name as string
computer_name = GetComputerName
.
..
...

Does the declaration need to be in a module?
A+, N+, MCP
 
Ahhhhh!

Tahnk you very much! A+, N+, MCP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top