How to use mstscax.dll function in .NET

  • Thread starter Thread starter Christopher Attard
  • Start date Start date
C

Christopher Attard

Hi,
I'm using mstscax.dll function in C# to try to open a user terminal session. But I'm having no response.

I'm addng a reference to the dll function and I'm using the same following code portion:

using MSTSCLib;


MSTSCLib.MsRdpClientClass ts; //global variable


.....
try
{
ts = new MsRdpClient2Class();
ts.OnConnecting += new IMsTscAxEvents_OnConnectingEventHandler(ts_OnConnecting);

ts.Server = "TerminalServername";

ts.UserName = "Username";

ts.Connect();

}

....

public void ts_OnConnecting

{

Console.WriteLine("Attempting to connect...");

}



But the OnConnecting event is not being triggered. I've also tried using MsTscAxClass() instead of MsRdpClient2Class() but no effect. Also, there no exceptions are being raised after invoking the Connect() method. Is there any other setting to be done prior to connecting...? Am I doing something wrong in the code? I've tested the terminal server's availability and I can successfully login remotely using mstsc.exe.
 
Back
Top