Paul,
Try this
Structure RECT
Public left, top, right, bottom As Integer
End Structure
Structure GUITHREADINFO
Public cbSize As Integer
Public flags As Integer
Public hwndActive As IntPtr
Public hwndFocus As IntPtr
Public hwndCapture As IntPtr
Public hwndMenuOwner As IntPtr
Public hwndMoveSize As IntPtr
Public hwndCaret As IntPtr
Public rcCaret As RECT
End Structure
Structure SECURITY_ATTRIBUTES
Public nLength As Integer
Public lpSecurityDescriptor As IntPtr
Public bInheritHandle As Boolean
End Strucure
Declare Auto Function CreateWindowStation Lib "user32.dll" (lpwinsta
As String, dwFlags As Integer, dwDesiredAccess As Integer, lpsa As
IntPtr) As IntPtr
Declare Function SetProcessWindowStation Lib "user32.dll" (hWinSta As
IntPtr) As Boolean
Declare Auto Function CreateDesktop Lib "user32.dll" (lpszDesktop As
String, lpszDevice As IntPtr, pDevmode As IntPtr, dwFlags As Integer,
dwDesiredAccess As Integer, lpsa As IntPtr) As IntPtr
Declare Function SetThreadDesktop Lib "user32.dll" (hDesktop As
IntPtr) As Boolean
Declare Function GetGUIThreadInfo Lib "user32.dll" (idThread As
Integer, ByRef lpgui As GUITHREADINFO) As Boolean
For CreateWindowStation and CreateDesktop, you can change the lpsa
parameter to ByRef lpsa As SECURITY_ATTRIBUTES if you actually want to
specify it (not pass NULL).
Mattias