这段程序为什么不能通过?
这个过程是参考DELPHI6帮助文件中的示例写的,但不通过,提示:
[Warning] Unit3.pas(49): Symbol 'FileGetAttr' is specific to a platform
[Warning] Unit3.pas(49): Symbol 'faReadOnly' is specific to a platform
[Warning] Unit3.pas(49): Symbol 'faReadOnly' is specific to a platform
[Warning] Unit3.pas(49): Symbol 'faArchive' is specific to a platform
[Warning] Unit3.pas(49): Symbol 'faArchive' is specific to a platform
[Warning] Unit3.pas(49): Symbol 'faSysFile' is specific to a platform
[Warning] Unit3.pas(49): Symbol 'faSysFile' is specific to a platform
[Warning] Unit3.pas(49): Symbol 'faHidden' is specific to a platform
[Warning] Unit3.pas(49): Symbol 'faHidden' is specific to a platform
[Warning] Unit3.pas(49): Symbol 'faReadOnly' is specific to a platform
[Error] Unit3.pas(49): Missing operator or semicolon
[Error] Unit3.pas(49): Statement expected, but expression of type 'Integer' found
[Warning] Unit3.pas(49): Symbol 'faArchive' is specific to a platform
[Error] Unit3.pas(49): Missing operator or semicolon
[Error] Unit3.pas(49): Statement expected, but expression of type 'Integer' found
[Warning] Unit3.pas(49): Symbol 'faSysFile' is specific to a platform
[Error] Unit3.pas(49): Missing operator or semicolon
[Error] Unit3.pas(49): Statement expected, but expression of type 'Integer' found
[Warning] Unit3.pas(49): Symbol 'faHidden' is specific to a platform
[Error] Unit3.pas(49): Missing operator or semicolon
[Error] Unit3.pas(49): Statement expected, but expression of type 'Integer' found
[Warning] Unit3.pas(49): Symbol 'FileSetAttr' is specific to a platform
[Error] Unit3.pas(49): Undeclared identifier: 'FileDirName'
[Error] Unit3.pas(49): Not enough actual parameters
[Error] Unit3.pas(49): '.' expected but ';' found
[Fatal Error] Project1.dpr(8): Could not compile used unit 'Unit3.pas'
过程代码:
procedure TForm3.FormShow(Sender: TObject);
var
Attributes, NewAttributes: Word;
begin
if Form1.Edit1.Text='*.*' then
begin
showmessage('请选择一个文件!');
close;
end
else
begin
Attributes := FileGetAttr(Form1.FileListBox1.FileName);
chkReadOnly.Checked := (Attributes and faReadOnly) = faReadOnly;
chkArchive.Checked := (Attributes and faArchive) = faArchive;
chkSystem.Checked := (Attributes and faSysFile) = faSysFile;
chkHidden.Checked := (Attributes and faHidden) = faHidden;
{ 如果屏蔽掉这部分就可以通过
if ShowModal <> id_Cancel then
begin
NewAttributes := Attributes;
if chkReadOnly.Checked then
NewAttributes := NewAttributes or faReadOnly
else
NewAttributes := NewAttributes andnot faReadOnly;
if chkArchive.Checked then
NewAttributes := NewAttributes or faArchive
else
NewAttributes := NewAttributes andnot faArchive;
if chkSystem.Checked then
NewAttributes := NewAttributes or faSysFile
else
NewAttributes := NewAttributes andnot faSysFile;
if chkHidden.Checked then
NewAttributes := NewAttributes or faHidden
else
NewAttributes := NewAttributes andnot faHidden;
if NewAttributes <> Attributes then
FileSetAttr(FileDirName.Caption, NewAttributes);
end;
}
end;
end;
恳请各位给予指点