Example:
Create a Form with Edit, 1 Button, 1 OpenDialog components, and two labels (as shown) write the following program listing on the Button1 at onclick event
procedure TF_CekTglModif.Button1Click(Sender: TObject);
var mFileHandle, mFileDate : integer;
mFileDateTime : tDateTime;
begin
if OpenDialog1.Execute then begin
Edit1.Text:=OpenDialog1.FileName;
mFileHandle:=FileOpen(Edit1.Text,fmOpenRead);
if mFileHandle= -1 then begin
showmessage('Failed Opening File');
exit;
end else begin
mFileDate:=FileGetDate(mFileHandle);
end;
mFileDateTime:=FileDateToDateTime(mFileDate);
Label2.Caption:=DateTimeToStr(mFileDateTime);
FileClose(mFileHandle);
end;
end;
No comments:
Post a Comment