Not a Member Yet,
Click here to Register

ID: 390
Viewed: 3520
Added: Aug 19, 2002
Version:
Snippet uploaded by: snippet
Written By: Unknown
Demo: Sorry, no demo



User Rated at: 0 Stars
Rate This:

Thank you for your vote. Please wait...

It appears you already voted for this snippet

It appears your vote value was empty

Gets the server name

Highlight all by clicking in box
<!---Declaration--->
Option Explicit

Private Declare Function lstrlenW Lib "kernel32" (ByVal lpString As Long) As Long
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Private Declare Function NetGetDCName Lib "Netapi32.dll" (strServer As Any, strDomain As Any, bufptr As Long) As Long
Private Declare Function NetApiBufferFree Lib "Netapi32.dll" (ByVal lpBuffer As Long) As Long

Highlight All
<!---Code--->
Private Sub Command1_Click()
Dim l As Long
Dim dc() As Byte
Dim bufptr As Long
l = NetGetDCName(ByVal 0&, _
ByVal 0&, _
bufptr)
MsgBox Pointer2stringw(bufptr)
NetApiBufferFree bufptr
End Sub


Private Function Pointer2stringw(ByVal l As Long) As String
Dim buffer() As Byte
Dim nLen As Long
nLen = lstrlenW(l) * 2
If nLen Then
ReDim buffer(0 To (nLen - 1)) As Byte
CopyMemory buffer(0), ByVal l, nLen
Pointer2stringw = buffer
End If
End Function

;


No Comments to show

Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.


Replying to a Comment...


Adding your comment. Please wait...

Thanks for adding your comment!. After further review it will be added.

There was a problem adding your comment. Please try again.

Please complete all the fields in the form before sending.

© 2002 - 2024 snippetlibrary.com All Rights Reserved. Conditions
Do NOT follow this link or you will be banned from the site!