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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

API calls to get terminal name 1

Status
Not open for further replies.

GlynA

Programmer
May 1, 2002
77
GB
Can someone please remind me what API calls are required to get the name of the terminal in use.

Thanks.

Glyn.
 
'example by Donavon Kuhn (Donavon.Kuhn@Nextel.com)
Private Const MAX_COMPUTERNAME_LENGTH As Long = 31
Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Private Sub Form_Load()
Dim dwLen As Long
Dim strString As String
'Create a buffer
dwLen = MAX_COMPUTERNAME_LENGTH + 1
strString = String(dwLen, "X")
'Get the computer name
GetComputerName strString, dwLen
'get only the actual data
strString = Left(strString, dwLen)
'Show the computer name
MsgBox strString
End Sub
 
I think you can use NetWkstaGetInfo, setting the level parameter to 100 to return a WKSTA_INFO_100 structure.

That structure has a member called wki100_computername, which is probably what you're after...

Hope that was helpful...

mmilan
 
Justin's code works fine.
Thanks.

Glyn.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top