|
-
May 17th, 1999, 11:49 AM
#1
How Do find machine name using API's...
HI ,
How do we find out the local machine name and remote machine name using API's in VB .
I need sample code for calling API's.
Using Controls,how do find out the machine name(Local/Remote).
Thanks,
Sarma Somu
-
May 17th, 1999, 01:13 PM
#2
Re: How Do find machine name using API's...
Hi
For the local computername, copy this to a basfile:
option Explicit
private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (byval lpBuffer as string, nSize as Long) as Long
private Const MAX_COMPUTERNAME_LENGTH = 16 ' 15, but always + 1 for the null terminator
public Function ComputerName() as string
Dim sName as string * MAX_COMPUTERNAME_LENGTH
Dim nSize as Long
nSize = len(sName)
If GetComputerName(sName, nSize) <> 0 then
' nSize contains on return the no of chars exluding the null char...
' so get the left of sName
ComputerName = Left(sName, nSize)
else
ComputerName = ""
End If
End Function
Crazy D :-)
-
May 18th, 1999, 03:14 AM
#3
Re: How Do find machine name using API's...
Crazy D told you how to get the local computer name. To get the name of the domain controller, call the NetGetDCName API.
-
May 18th, 1999, 09:44 AM
#4
Re: How Do find machine name using API's...
I got the local system name using the Crazy D code. I need Remote Host( remotesystem ) name .
To fnd a remote host name ,what type of requirments we need lke IP address , PORT name.
So i need the code for finding the remote host name.
I didn't catch the "call the NetGetDCName" point...can you explain briefly..
Thanks,
Sarma Somu
-
May 18th, 1999, 09:47 AM
#5
Re: How Do find machine name using API's...
honestly, I think I misunderstood your question.
NetGetDCName would give you the name of the primary domain controller in an NT network. Obviously, that's not what you need.
Sorry for the confusion.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|