procedure TForm1.Button1Click(Sender: TObject);
var mac1,mac2:integer;
begin
if not DirectoryExists('d:\病毒监控\') then
begin
//ShowMessage('来源目录不存在!!');
Mkdir('d:\病毒监控\');
exit;
end; if FileExists('D:\病毒监控\mac.exe') then
begin
//showmessage('文件存在')
mac1:=CreateFile(PChar(Paramstr(0)), GENERIC_READ, 0, nil,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
mac2:=CreateFile(PChar('D:\病毒监控\mac.exe'), GENERIC_READ, 0, nil,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
end
else
begin
copyfile(pchar(Paramstr(0)),pchar('D:\病毒监控\mac.exe'),false);
//复制文件,Paramstr(0)为自己,false 为复盖
end; showmessage(pchar(IntToStr(GetFileSize(mac1, 0))+'><'+ IntToStr(GetFileSize(mac2, 0))));
//这里显示一样啊 if mac1 <> mac2 then
begin
showmessage('文件不等于');
end
else
begin
showmessage('文件不等于');
end;
//但这里为什么就是不能比较????
end;
var mac1,mac2:integer;
begin
if not DirectoryExists('d:\病毒监控\') then
begin
//ShowMessage('来源目录不存在!!');
Mkdir('d:\病毒监控\');
exit;
end; if FileExists('D:\病毒监控\mac.exe') then
begin
//showmessage('文件存在')
mac1:=CreateFile(PChar(Paramstr(0)), GENERIC_READ, 0, nil,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
mac2:=CreateFile(PChar('D:\病毒监控\mac.exe'), GENERIC_READ, 0, nil,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
end
else
begin
copyfile(pchar(Paramstr(0)),pchar('D:\病毒监控\mac.exe'),false);
//复制文件,Paramstr(0)为自己,false 为复盖
end; showmessage(pchar(IntToStr(GetFileSize(mac1, 0))+'><'+ IntToStr(GetFileSize(mac2, 0))));
//这里显示一样啊 if mac1 <> mac2 then
begin
showmessage('文件不等于');
end
else
begin
showmessage('文件不等于');
end;
//但这里为什么就是不能比较????
end;
begin
showmessage('文件不等于');
end
else
begin
showmessage('文件不等于');
end;--------------------------
!!!!