windows-nt/Source/XPSP1/NT/admin/pchealth/helpctr/rc/unittest/rcclient.htm
2020-09-26 16:20:57 +08:00

146 lines
3.6 KiB
HTML

<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
</HEAD>
<BODY topMargin=0>
<P>&nbsp;</P>
<P>&nbsp;</P>
<P align=center><FONT face="Arial Black" size=5><STRONG>PCHealth Remote Control
Unittest (Client)</STRONG></FONT></P>
<TABLE>
<TR>
<TD><BUTTON id=connectButton name=connectButton onclick=ConnectButtonHandler()>Connect</BUTTON></TD>
<TD></INPUT></TD>
<TD><BUTTON id=disconnectButton name=disconnectButton onclick=DisconnectButtonHandler()>Disconnect</BUTTON></TD></TR>
</TABLE>
<TABLE border=0 cellPadding=0 cellSpacing=0 style="LEFT: 10px; TOP: 31px">
<TBODY>
<TR>
<TD>
<P>
<OBJECT classid=clsid:299BE050-E83E-4DB7-A7DA-D86FDEBFE6D0
data=data:application/x-oleobject;base64,UOCbKT7ot02n2thv3r/m0AADAAAlQgAAnDEAAA==
height=480 id=ClientHost name=ClientHost
style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; HEIGHT: 480px; WIDTH: 640px"
width=640></OBJECT>
</P>
</TD>
</TR>
</TBODY>
</TABLE>
<P></P>
<TABLE>
<TR>
<TD>
</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 tFileName = "\\\\pchealth\\public\\rc\\parms.txt";
function ConnectedHandler() {
alert("ClientHost_Connected");
}
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) {
alert("ClientHost_Disconnected");
}
function RemoteControlRequestCompleteHandler(status) {
alert("ClientHost_RemoteControlRequestComplete");
}
function ChannelDataReadyHandler(channelID) {
var str;
str = ChatChannel.ReceiveChannelData();
incomingChatText.value = incomingChatText.value + "\n" + str;
}
function ConnectButtonHandler() {
try {
RemoteDesktopClientObj = ClientHost.GetRemoteDesktopClient();
// Bind the event handlers for this object.
RemoteDesktopClientObj.OnConnected = function()
{ ConnectedHandler(); }
RemoteDesktopClientObj.OnDisconnected = function(reason)
{ DisconnectedHandler(reason); }
RemoteDesktopClientObj.OnConnectRemoteDesktopComplete = function(status)
{ RemoteControlRequestCompleteHandler(status); }
// Add the 'chat' channel.
ChannelManager = RemoteDesktopClientObj.ChannelManager;
if (ChatChannel == null) {
ChatChannel = ChannelManager.OpenDataChannel("70");
ChatChannel.OnChannelDataReady = function()
{ ChannelDataReadyHandler(); }
}
//
// Read Connection Parms
//
var fso = new ActiveXObject("Scripting.FileSystemObject");
var ForReading = 1, ForWriting = 2, ForAppending = 8;
var TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0;
var file = fso.GetFile(tFileName);
var fileHandle = file.OpenAsTextStream(ForReading,TristateUseDefault);
var s = fileHandle.ReadLine();
RemoteDesktopClientObj.ConnectParms = s;
RemoteDesktopClientObj.ConnectToServer("");
fileHandle.Close();
} catch (e) {
alert(e.Description);
}
}
</SCRIPT>
</BODY>
</HTML>