WindowsXP-SP1/termsrv/remdsk/unittest/client/salemclientcallbck.htm
2020-09-30 16:53:49 +02:00

358 lines
16 KiB
HTML

<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
</HEAD>
<BODY topMargin=0>
<TABLE>
<TR>
<TD><BUTTON id=createListenButton name=createListenButton onclick=createListenButtonHandler()>Create Listen</BUTTON></TD>
<TD><INPUT id=expertConnectParms name=expertConnectParms
style="WIDTH: 400px" width="400"></INPUT></TD>
<TD><BUTTON id=startListenButton name=startListenButton onclick=startListenButtonHandler()>Start Listen</BUTTON></TD>
<TD><BUTTON id=stopListenButton name=stopListenButton onclick=stopListenButtonHandler()>Stop Listen</BUTTON></TD>
<TD><BUTTON id=acceptListenButton name=acceptListenButton onclick=acceptListenButtonHandler()>Accept</BUTTON></TD>
<TR>
<TD><BUTTON id=connectButton name=connectButton onclick=ConnectButtonHandler()>Connect</BUTTON></TD>
<TD><INPUT id=parmsInput name=parmsInput
style="WIDTH: 400px" width="400"></INPUT></TD>
<TD><BUTTON id=disconnectButton name=disconnectButton onclick=DisconnectButtonHandler()>Disconnect</BUTTON></TD></TR>
</TABLE>
<TABLE border=0 cellPadding=0 cellSpacing=0>
<TBODY>
<TR>
<TD>
<P>
<OBJECT id=ClientHost
style="BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-LEFT: black 1px solid; WIDTH: 640px; BORDER-BOTTOM: black 1px solid; HEIGHT: 480px"
height=480 width=640
data=data:application/x-oleobject;base64,UOCbKT7ot02n2thv3r/m0AADAAAlQgAAnDEAAA==
classid=clsid:299BE050-E83E-4DB7-A7DA-D86FDEBFE6D0
name=ClientHost></OBJECT>
</P>
</TD>
</TR>
</TBODY>
</TABLE>
<P></P>
<BUTTON id=remoteControlButton name=RemoteControlButton onclick=RemoteControlButtonHandler()>Remote Control</BUTTON>
<BUTTON id=stopRemoteControlButton name=stopRemoteControlButton onclick=RemoteControlEndButtonHandler()>Stop Remote Control</BUTTON>&nbsp;
<TABLE>
<TR>
<TD>
<TABLE>
<TR>
<TD><INPUT id=incomingChatText name=incomingChatText height="150" style="WIDTH: 275px; HEIGHT: 150px" width="275"
></INPUT></TD>
</TR>
<TR>
<TD><INPUT id=chatText name=chatText style="WIDTH: 275px" width="275" ></INPUT></TD>
<TD><BUTTON id=sendChatButton name=sendChatButton onclick=SendChatButtonHandler()>Send</BUTTON></TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
<SCRIPT Language="JScript">
var RemoteDesktopClientObj = null;
var QryMgr = null;
var FolderNodeId = 0;
var RootDataCol = null;
var ChannelManager = null;
var ChatChannel = null;
var Server = null;
var Port = null;
var expertParm = null;
function ConnectedHandler() {
Server = RemoteDesktopClientObj.ConnectedServer;
Port = RemoteDesktopClientObj.ConnectedPort;
alert("ClientHost_Connected " + Server + " " + Port);
}
function ListenConnectHandler(status) {
if( status == 0 ) {
alert("Listen succeeded, click Accept to connect");
}
else {
alert( "ListenConnect failed with status " + status );
}
}
function SendChatButtonHandler() {
if (ChatChannel != null) {
ChatChannel.SendChannelData(chatText.value);
}
}
function DisconnectButtonHandler() {
if (RemoteDesktopClientObj != null) {
RemoteDesktopClientObj.DisconnectFromServer();
}
}
function RemoteControlButtonHandler() {
if (RemoteDesktopClientObj != null) {
RemoteDesktopClientObj.ConnectRemoteDesktop();
}
}
function RemoteControlEndButtonHandler() {
if (RemoteDesktopClientObj != null) {
RemoteDesktopClientObj.DisconnectRemoteDesktop();
}
}
function DisconnectedHandler(reason) {
var str = "Unknown Error!!!!";
switch(reason) {
case 0 : str = "SAFERROR_NOERROR";
break;
case 1 : str = "SAFERROR_NOINFO";
break;
case 3 : str = "SAFERROR_LOCALNOTERROR";
break;
case 4 : str = "SAFERROR_REMOTEBYUSER";
break;
case 5 : str = "SAFERROR_BYSERVER";
break;
case 6 : str = "SAFERROR_DNSLOOKUPFAILED";
break;
case 7 : str = "SAFERROR_OUTOFMEMORY";
break;
case 8 : str = "SAFERROR_CONNECTIONTIMEDOUT";
break;
case 9 : str = "SAFERROR_SOCKETCONNECTFAILED";
break;
case 11 : str = "SAFERROR_HOSTNOTFOUND";
break;
case 12 : str = "SAFERROR_WINSOCKSENDFAILED";
break;
case 14 : str = "SAFERROR_INVALIDIPADDR";
break;
case 15 : str = "SAFERROR_SOCKETRECVFAILED";
break;
case 18 : str = "SAFERROR_INVALIDENCRYPTION";
break;
case 20 : str = "SAFERROR_GETHOSTBYNAMEFAILED";
break;
case 21 : str = "SAFERROR_LICENSINGFAILED";
break;
case 22 : str = "SAFERROR_ENCRYPTIONERROR";
break;
case 23 : str = "SAFERROR_DECRYPTIONERROR";
break;
case 24 : str = "SAFERROR_INVALIDPARAMETERSTRING";
break;
case 25 : str = "SAFERROR_HELPSESSIONNOTFOUND";
break;
case 26 : str = "SAFERROR_INVALIDPASSWORD";
break;
case 27 : str = "SAFERROR_HELPSESSIONEXPIRED";
break;
case 28 : str = "SAFERROR_CANTOPENRESOLVER";
break;
case 29 : str = "SAFERROR_UNKNOWNSESSMGRERROR";
break;
case 30 : str = "SAFERROR_CANTFORMLINKTOUSERSESSION";
break;
case 31 : str = "SAFERROR_SHADOWFAILED";
break;
case 32 : str = "SAFERROR_RCPROTOCOLERROR";
break;
case 33 : str = "SAFERROR_RCUNKNOWNERROR";
break;
case 34 : str = "SAFERROR_INTERNALERROR";
break;
}
var msg = "ClientHost_Disconnected: " + str;
alert(msg);
}
function RemoteControlRequestCompleteHandler(status) {
var str = "Unknown Error!!!!";
if (status != 0) {
switch(status) {
case 0 : str = "SAFERROR_NOERROR";
break;
case 1 : str = "SAFERROR_NOINFO";
break;
case 3 : str = "SAFERROR_LOCALNOTERROR";
break;
case 4 : str = "SAFERROR_REMOTEBYUSER";
break;
case 5 : str = "SAFERROR_BYSERVER";
break;
case 6 : str = "SAFERROR_DNSLOOKUPFAILED";
break;
case 7 : str = "SAFERROR_OUTOFMEMORY";
break;
case 8 : str = "SAFERROR_CONNECTIONTIMEDOUT";
break;
case 9 : str = "SAFERROR_SOCKETCONNECTFAILED";
break;
case 11 : str = "SAFERROR_HOSTNOTFOUND";
break;
case 12 : str = "SAFERROR_WINSOCKSENDFAILED";
break;
case 14 : str = "SAFERROR_INVALIDIPADDR";
break;
case 15 : str = "SAFERROR_SOCKETRECVFAILED";
break;
case 18 : str = "SAFERROR_INVALIDENCRYPTION";
break;
case 20 : str = "SAFERROR_GETHOSTBYNAMEFAILED";
break;
case 21 : str = "SAFERROR_LICENSINGFAILED";
break;
case 22 : str = "SAFERROR_ENCRYPTIONERROR";
break;
case 23 : str = "SAFERROR_DECRYPTIONERROR";
break;
case 24 : str = "SAFERROR_INVALIDPARAMETERSTRING";
break;
case 25 : str = "SAFERROR_HELPSESSIONNOTFOUND";
break;
case 26 : str = "SAFERROR_INVALIDPASSWORD";
break;
case 27 : str = "SAFERROR_HELPSESSIONEXPIRED";
break;
case 28 : str = "SAFERROR_CANTOPENRESOLVER";
break;
case 29 : str = "SAFERROR_UNKNOWNSESSMGRERROR";
break;
case 30 : str = "SAFERROR_CANTFORMLINKTOUSERSESSION";
break;
case 31 : str = "SAFERROR_SHADOWFAILED";
break;
case 32 : str = "SAFERROR_RCPROTOCOLERROR";
break;
case 33 : str = "SAFERROR_RCUNKNOWNERROR";
break;
case 34 : str = "SAFERROR_INTERNALERROR";
break;
}
var msg = "RemoteControlRequestCompleteHandler: " + str;
alert(msg);
}
}
function ChannelDataReadyHandler(channelID) {
var str;
str = ChatChannel.ReceiveChannelData();
incomingChatText.value = incomingChatText.value + "\n" + str;
}
function ConnectButtonHandler() {
if (RemoteDesktopClientObj == null) {
RemoteDesktopClientObj = ClientHost.GetRemoteDesktopClient();
// RemoteDesktopClientObj.EnableSmartSizing = true;
// Bind the event handlers for this object.
RemoteDesktopClientObj.OnConnected = function()
{ ConnectedHandler(); }
RemoteDesktopClientObj.OnDisconnected = function(reason)
{ DisconnectedHandler(reason); }
RemoteDesktopClientObj.OnConnectRemoteDesktopComplete = function(status)
{ RemoteControlRequestCompleteHandler(status); }
RemoteDesktopClientObj.OnListenConnect = function(status)
{ ListenConnectHandler(status); }
// Add the 'chat' channel.
ChannelManager = RemoteDesktopClientObj.ChannelManager;
if (ChatChannel == null) {
ChatChannel = ChannelManager.OpenDataChannel("70");
ChatChannel.OnChannelDataReady = function()
{ ChannelDataReadyHandler(); }
}
}
RemoteDesktopClientObj.ConnectParms = parmsInput.value;
RemoteDesktopClientObj.ConnectToServer("12345");
}
function createListenButtonHandler() {
if (RemoteDesktopClientObj == null) {
RemoteDesktopClientObj = ClientHost.GetRemoteDesktopClient();
// RemoteDesktopClientObj.EnableSmartSizing = true;
// Bind the event handlers for this object.
RemoteDesktopClientObj.OnConnected = function()
{ ConnectedHandler(); }
RemoteDesktopClientObj.OnDisconnected = function(reason)
{ DisconnectedHandler(reason); }
RemoteDesktopClientObj.OnConnectRemoteDesktopComplete = function(status)
{ RemoteControlRequestCompleteHandler(status); }
RemoteDesktopClientObj.OnListenConnect = function(status)
{ ListenConnectHandler(status); }
// Add the 'chat' channel.
ChannelManager = RemoteDesktopClientObj.ChannelManager;
if (ChatChannel == null) {
ChatChannel = ChannelManager.OpenDataChannel("70");
ChatChannel.OnChannelDataReady = function()
{ ChannelDataReadyHandler(); }
}
}
expertParm = RemoteDesktopClientObj.CreateListenEndpoint( 0 );
expertConnectParms.value = expertParm;
alert("Click Start Listen to begin waiting for connection");
}
function acceptListenButtonHandler() {
if (RemoteDesktopClientObj == null) {
alert("Must Create Listen first");
}
else if( parmsInput.value == "" ) {
alert("No connect parm.");
}
else {
RemoteDesktopClientObj.ConnectParms = parmsInput.value;
RemoteDesktopClientObj.AcceptListenConnection( "12345" );
}
}
function stopListenButtonHandler() {
if (RemoteDesktopClientObj == null) {
alert("Must Create Listen first");
}
else {
expertParm = RemoteDesktopClientObj.StopListen();
}
}
function startListenButtonHandler() {
if (RemoteDesktopClientObj == null) {
alert("Must Create Listen first");
}
else {
expertParm = RemoteDesktopClientObj.StartListen( 0 );
}
}
</SCRIPT>
</BODY>
</HTML>