文件拷贝的问题![急急急急急急急急急急急急!](100分)

  • 主题发起人 主题发起人 yeser_macao
  • 开始时间 开始时间
Y

yeser_macao

Unregistered / Unconfirmed
GUEST, unregistred user!
请各位指点一下,局域网中如何进行文件拷贝。如:将 PC1 中的c:/system.ini文件复制到 PC2 c:/中去
 
不明白你的意思,讲清楚一点好吗?
 
win2000下

接收端
procedure TWait.Button1Click(Sender: TObject);
begin
close;
ClientSocket1.Active:=false;
end;

procedure TWait.ClientSocket1Error(Sender: TObject;
Socket: TCustomWinSocket; ErrorEvent: TErrorEvent;
var ErrorCode: Integer);
begin
ErrorCode:=0;
end;

procedure TWait.ClientSocket1Read(Sender: TObject;
Socket: TCustomWinSocket);
var
s:string;
begin
if socket.ReceiveText='send' then
begin
WNetAddConnection('//192.168.0.60/chan','','192.168.0.20');
copyfile(PChar(filepath+'chan/'+sendfile),PChar('//192.168.0.60/chan/'+sendfile),false);
label1.Caption:='与监控端连接成功!';
button1.Caption:='关闭';
timer1.Enabled:=false;
ClientSocket1.Active:=false;
runselect.jingli();
runselect.runmenu();
wait.SetFocus;
end;
end;

procedure TWait.ClientSocket1Write(Sender: TObject;
Socket: TCustomWinSocket);
begin
socket.SendText('send');
end;

procedure TWait.FormCreate(Sender: TObject);
begin
filepath := ExtractFilePath(Application.ExeName);
Clientsocket1.Active:=true;
end;

发送端
procedure Tlisten.Button1Click(Sender: TObject);
begin
close;
serversocket1.Active:=false;
end;

procedure Tlisten.ServerSocket1ClientError(Sender: TObject;
Socket: TCustomWinSocket; ErrorEvent: TErrorEvent;
var ErrorCode: Integer);
begin
ErrorCode:=0;
end;

procedure Tlisten.FormCreate(Sender: TObject);
begin
ServerSocket1.Active:=true;
end;

procedure Tlisten.Timer1Timer(Sender: TObject);
begin
showmessage('监听失败!');
close;
end;

procedure Tlisten.ServerSocket1ClientRead(Sender: TObject;
Socket: TCustomWinSocket);
begin
if socket.ReceiveText='send' then
begin
label1.Caption:='与被监控端连接成功!';
button1.Caption:='关闭';
timer1.Enabled:=false;
socket.SendText('send');
serversocket1.Active:=false;
Close;
end;
end;
 
直接用CopyFile(Pchar(C:/文件1.exe),Pchar(//PC2/目录1/文件1.exe));
其中PC2的目录1要完全共享
 
谢谢各位的支持,我已经找到方法了,就是沙_儿所说的。wab你的建议因为太复杂所以没有采纳!
不过还是非常感谢!
 
如何用进度条实现?谢谢!!!
 

Similar threads

D
回复
0
查看
767
DelphiTeacher的专栏
D
D
回复
0
查看
809
DelphiTeacher的专栏
D
后退
顶部