E
Eroswar
Unregistered / Unconfirmed
GUEST, unregistred user!
library dell;uses SysUtils, Classes, ShareMem, ShellAPI, Windows;{$R *.res}Function dellxp(FileName: string):string;stdcall;var max,n: LongInt; i: integer; fs: TFileStream; buffer: array[0..4095] of char;begin for i:=Low(buffer) to High(buffer) do buffer:=#0; fs:=TFileStream.Create(FileName,fmOpenReadWrite or fmShareExclusive); try n:=4096; max:=fs.Size; fs.Position:=0; while max>0 do begin if max<n then n:=max; fs.Write(buffer,n); max:=max-n; end; FlushFileBuffers(fs.Handle); finally fs.Free; end; Deletefile(FileName); //提示错误信息:[Error] dell.dpr(35): Incompatible types: 'String' and 'PAnsiChar'end;exports dellxp;beginend.--------------------------------------------------------------------------[Error] dell.dpr(35): Incompatible types: 'String' and 'PAnsiChar'怎么样解决???--------------------------------------------------------------------------Function dellxp(FileName: string):string;stdcall;external 'Dell.dll';procedure TForm1.Button1Click(Sender: TObject);begin//比如我想让程序运行后调用Dell.DLL里的dellxp函数子程来删除指定的某文件如d:/abc/a/atx.txt里的atx.txt文件或者如下的路径varTempDir: array[0..MAX_PATH] of Char;//定义临时目录----------------------------------------------------GetSystemDirectory(TempDir, MAX_PATH);DirTemp := StrPas(TempDir)+'/'+'Avixg';DirTemp路径下的atx.txt文件?FileName:= Edit1.Text ???怎么样把文件名和路径传递给dellxp用来删除它·~如上的DLL代码不知有没有错误?请朋友们帮我看看~最好给个源码,帮我改改end;