views:

196

answers:

3

I'm using the RDP ActiveX control in a web page to open remote desktop connections. Here is the code I using but it doesn't work, it gets stuck when calling the GetErrorDescription method:

<script language="vbscript">

    sub MsRdpClient_OnDisconnected(disconnectCode)

      dim error_message

      extendedDiscReason = MsRdpClient.ExtendedDisconnectReason

      MsRdpClient.GetErrorDescription disconnectCode, extendedDiscReason, error_message

      MsgBox error_message, 0, "Error"

    end sub

</script>

Thanks, Rafael

A: 

I think you're hitting this [1] limitation. VBScript works exclusively with Variants, so it can't accept out parameters of more specific types.

Since you can't change the RDP ActiveX control, there is little you can do besides writing a thin C++ wrapper. But that comes with other headaches...

[1] http://support.microsoft.com/kb/197957

Kim Gräsman
I see, Thank you very much Kim, the problem I have is that the OnDisconnected event is giving me a disconnectedCode that is not documented, at least is not listed here:http://msdn.microsoft.com/en-us/library/aa380834(VS.85).aspx
Rafael Luna
Wrong link, sorry, this is the correct one:http://msdn.microsoft.com/en-us/library/aa382170(VS.85).aspx
Rafael Luna
A: 

I found the answer at the TechNet Forums.

<script language="vbscript">

    sub MsRdpClient_OnDisconnected(disconnectCode)

      dim error_message

      extendedDiscReason = MsRdpClient.ExtendedDisconnectReason

      error_message = MsRdpClient.GetErrorDescription(disconnectCode, extendedDiscReason)

      MsgBox error_message, 0, "Error"

    end sub

</script>

Now I only need to know how to write the MsRdpClient events handlers in javascript instead of vbscript.

Rafael Luna
A: 

Hey Rafael,

Wanted some help. The event handler that I have, is not having the disconnectCode param. I am using JavaScript. If i add it, its value stays UnDefined.

Thanks in advance for any help or pointers that u might give in

SG