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

Accessing API's from .Net

Status
Not open for further replies.

Ogi

Technical User
Nov 9, 2001
896
GB
Hi,

Can anyone help me in converting this VB code to .NET ?

I need to access the Terminal Services API and haven't worked out how to do the following:-

Public Declare Function WTSOpenServerA Lib "wtsapi32.dll" ( _
ByVal pServerName As String) As Long

Public Declare Function WTSCloseServer Lib "wtsapi32.dll" ( _
ByVal hServer As Long) As Long

Public Declare Function WTSEnumerateSessions _
Lib "wtsapi32.dll" Alias "WTSEnumerateSessionsA" ( _
ByVal hServer As Long, ByVal Reserved As Long, _
ByVal Version As Long, ByRef ppSessionInfo As Long, _
ByRef pCount As Long _
) As Long

Public Declare Function WTSQuerySessionInformation Lib "wtsapi32.dll" _
Alias "WTSQuerySessionInformationA" (ByVal hServer As Long, _
ByVal SessionID As Long, ByVal WTS_INFO_CLASS As WTSInfoClass, _
ByRef QSbuffer As Long, ByRef pCount As Long) As Long

Public Declare Sub WTSFreeMemory Lib "wtsapi32.dll" ( _
ByVal pMemory As Long)

Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" ( _
Destination As Any, Source As Any, ByVal Length As Long)

Public Declare Function lstrlenA Lib "kernel32" ( _
ByVal lpString As String) As Long

Public Declare Function lstrcpy Lib "kernel32" Alias "lstrcpyA" ( _
ByVal lpString1 As String, ByVal lpString2 As Long) As Long


Thanks for any help given.

Cheers,
Carl.
 
Carl

What help do you need?. Do you have any problems with the declarations?

I only use one API call in my apps, and I use it as follows
Code:
    Private Declare Function HideCaret Lib "user32" (ByVal hwnd As Long) As Long
     HideCaret(Me.xMoveTo.Handle.ToInt32)



Sweep
...if it works dont mess with it
 
Hi,

In .Net how do you define the "alias" bit?

Cheers,
Carl.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top