W wingkk Unregistered / Unconfirmed GUEST, unregistred user! 2003-01-15 #1 我想作一个程序,程序开始的时候判断一个条件,如果成立,则把程序自身复制到一个指定的目录中,<br>不知道用API能不能实现,或者别的方法也行!!!
Y ysai Unregistered / Unconfirmed GUEST, unregistred user! 2003-01-15 #2 CopyFile(PChar(Application.ExeName),'c:/a.exe',True);<br>
Z zw84611 Unregistered / Unconfirmed GUEST, unregistred user! 2003-01-15 #3 CopyFile(pchar(ParamStr(0)),'c:/a.exe',FALSE);
来 来如风 Unregistered / Unconfirmed GUEST, unregistred user! 2003-01-15 #4 可以的<br>CopyFile(pchar(paramstr(0)),'F:/ss.exe',false);<br>
N naughtboy Unregistered / Unconfirmed GUEST, unregistred user! 2003-01-16 #5 {This way uses a File stream.}<br>Procedure FileCopy( Const sourcefilename, targetfilename: String );<br>Var<br> S, T: TFileStream;<br>Begin<br> S := TFileStream.Create( sourcefilename, fmOpenRead );<br><br> try<br> T := TFileStream.Create( targetfilename,<br> fmOpenWrite or fmCreate );<br> try<br> T.CopyFrom(S, S.Size ) ;<br> finally<br> T.Free;<br> end;<br> finally<br> S.Free;<br> end;<br>End;<br><br>
{This way uses a File stream.}<br>Procedure FileCopy( Const sourcefilename, targetfilename: String );<br>Var<br> S, T: TFileStream;<br>Begin<br> S := TFileStream.Create( sourcefilename, fmOpenRead );<br><br> try<br> T := TFileStream.Create( targetfilename,<br> fmOpenWrite or fmCreate );<br> try<br> T.CopyFrom(S, S.Size ) ;<br> finally<br> T.Free;<br> end;<br> finally<br> S.Free;<br> end;<br>End;<br><br>
W wingkk Unregistered / Unconfirmed GUEST, unregistred user! 2003-01-17 #8 有没有只复制程序一部分的,比如几行代码,然后生成一个新的EXE文件???