关于参数问题!copyfile(pchar(file1),pchar(file2),false); (50分)

C

cjjlqq

Unregistered / Unconfirmed
GUEST, unregistred user!
我做了个DLL文件在ASP中调用,其中用到了CopyFile()函数,我本来是想在ASP文件指定路径,但是文件拷贝没
有成功后来我在DLL中指定路径却能拷贝成功为什么会这样,怎么解决?

unit copyf;

interface

uses
ComObj, ActiveX, AspTlb, cjj_TLB, StdVcl, Windows,
SysUtils, Classes, Controls, StdCtrls;

type
TCopyFile = class(TASPObject, ICopyFile)
protected
procedure Copyf(const File1, File2: WideString)
safecall;
end;

implementation

uses ComServ;

procedure TCopyFile.Copyf(const File1, File2: WideString);
begin
[blue]//CopyFile(PChar(File1),PChar(File2),False);[/blue]
[red]CopyFile(PChar('//yhl/test1/aa.txt'),PChar('d:/aa.txt'),False);[/red]
end;

initialization
TAutoObjectFactory.Create(ComServer, TCopyFile, Class_CopyFile,
ciMultiInstance, tmApartment);
end.


*************************
asp file
*************************
<HTML>
<BODY>
<TITLE> Testing Delphi ASP </TITLE>
<CENTER>
<H3> You should see the results of your Delphi Active Server method below </H3>
</CENTER>
<HR>
<% Set DelphiASPObj = Server.CreateObject("cjj.Copyf")
DelphiASPObj.copyf "//yhl/test1/aa.txt","d:/aa.txt"
Response.Write ("拷贝成功!")
%>
<HR>
</BODY>
</HTML>
 
顶部