R
Rainman
I have tried and tried to find sample code for enumerating terminal
servers from within Visual Basic using WTSEnumberateServers.
I have tried to get my code to work, but it continues to fail. I get
an error code 1784 ... something related to the pointer to the array, I
think. I am not that good at converting C type declarations to Visual
Basic compliant declarations.
Here are the docs from the SDK:
WTSEnumerateServers
The WTSEnumerateServers function returns a list of all terminal servers
within the specified Windows NT domain.
BOOL WTSEnumerateServers(
LPTSTR pDomainName,
DWORD Reserved,
DWORD Version,
PWTS_SERVER_INFO ppServerInfo
);
Parameters
pDomainName
[in] Pointer to the name of the Windows NT domain to be queried. If the
value of this parameter is NULL, the specified domain is the current
domain.
Reserved
[in] Reserved. The value of this parameter must be 0.
Version
[in] Version of the enumeration request. The value of the parameter
must be 1.
ppServerInfo
Points to an array of WTS_SERVER_INFO structures, which contains the
returned results of the enumeration. After use, the memory used by this
buffer should be freed by calling WTSFreeMemory.
My code does this:
Private Declare Function WTSEnumerateServers _
Lib "wtsapi32.dll" Alias "WTSEnumerateServersA" ( _
ByVal lpDomainName As String, ByVal Reserved As Long, _
ByVal Version As Long, ByRef ppServerInfo As Long, ByRef pCount As
Long) As Long
Dim lRetVal as long
dim lpBuffer as long
dim Count as integer
lRetVal = WTSEnumerateServers("DOMAINNAME", 0&, 1, lpBuffer, ByVal
Count)
Cany anyone supply me with sample code?
Regards,
Raney
(e-mail address removed)
servers from within Visual Basic using WTSEnumberateServers.
I have tried to get my code to work, but it continues to fail. I get
an error code 1784 ... something related to the pointer to the array, I
think. I am not that good at converting C type declarations to Visual
Basic compliant declarations.
Here are the docs from the SDK:
WTSEnumerateServers
The WTSEnumerateServers function returns a list of all terminal servers
within the specified Windows NT domain.
BOOL WTSEnumerateServers(
LPTSTR pDomainName,
DWORD Reserved,
DWORD Version,
PWTS_SERVER_INFO ppServerInfo
);
Parameters
pDomainName
[in] Pointer to the name of the Windows NT domain to be queried. If the
value of this parameter is NULL, the specified domain is the current
domain.
Reserved
[in] Reserved. The value of this parameter must be 0.
Version
[in] Version of the enumeration request. The value of the parameter
must be 1.
ppServerInfo
Points to an array of WTS_SERVER_INFO structures, which contains the
returned results of the enumeration. After use, the memory used by this
buffer should be freed by calling WTSFreeMemory.
My code does this:
Private Declare Function WTSEnumerateServers _
Lib "wtsapi32.dll" Alias "WTSEnumerateServersA" ( _
ByVal lpDomainName As String, ByVal Reserved As Long, _
ByVal Version As Long, ByRef ppServerInfo As Long, ByRef pCount As
Long) As Long
Dim lRetVal as long
dim lpBuffer as long
dim Count as integer
lRetVal = WTSEnumerateServers("DOMAINNAME", 0&, 1, lpBuffer, ByVal
Count)
Cany anyone supply me with sample code?
Regards,
Raney
(e-mail address removed)