You can use WTSOpenServer to connect to a remote machine, in c/c++:
#include <wtsapi32.h>
....
HANDLE hSrv = NULL;
hSrv = WTSOpenServer(pServerName);
....
....
Please msdn for more info:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/termserv/termse
rv/terminal_services_api_reference.asp

Signature
This posting is provided "AS IS" with no warranties, and confers no rights
> Hello,
>
> I am looking for some code examples the uses the wtsapi32.dll to connect to another machine.
> No matter in what language.
>
> Can anybody help me out?