在delphi中如何获取图片文件的拍摄的日期和时间???(100分)

  • 主题发起人 主题发起人 ssssssss
  • 开始时间 开始时间
S

ssssssss

Unregistered / Unconfirmed
GUEST, unregistred user!
一、也就是说,用数码相机拍的照片,在复制到电脑中后,如何获取这些照片的拍摄的日期和时间,即在窗体中通过一打开按钮,在选择某一张JPG照片后,这张照片的拍摄的日期和时间分别自动出现在两个edit文本框中。

请各位高手告知小妹如何在delphi中实现这段代码。

如点击按钮后,打开对话框,在我的文档中选择图片文件:风景1.JPG,则风景1.JPG的拍摄的原始日期和时间都自动出现在EDIT文本框中。如2006-05-20,13:25:20

二、另一外问题是:
在窗体中有5个文本框,无论在哪个框中输入内容,都可实现查询,比如,
edit1、edit2、edit3、edit4、edit5五个文本框,则有以下可能:
1空2345不空,则进行2345框的匹配查询
12空345不空,则进行345框的匹配查询
123空45不空,则进行45框的匹配查询
1234空5不空,则进行5框的匹配查询
12345空,  则为总库
124空35不空,则进行35框的匹配查询
1245空3不空,则进行3框的匹配查询
125空34不空,则进行34框的匹配查询
134空25不空,则进行25框的匹配查询
1345空2不空,则进行2框的匹配查询
14空235不空,则进行235框的匹配查询
.......(依此排列组合)
5空1234不空,则进行1234框的匹配查询

请高手给出比较好的代码吧  谢谢了
var x:string;
begin
x:='select * from main'//问题在此
// 如edit1为空,则写为x:='select * from main where xx2=:edit2.text and xx3=:edit3.text and xx4=:edit4.text and xx5=:edit5.text;
// 如edit1和edit2为空,则写为x:='select * from main where xx3=:edit3.text and xx4=:edit4.text and xx5=:edit5.text;
// 如edit1和edit2和edit3为空,则写为x:='select * from main where xx4=:edit4.text and xx5=:edit5.text;

Query1.SQL.Close;
Query1.SQL.Clear;
quwry1,sql.add(x);//问题在此,这里的SQL查询表达的生成来自上面的排列组合,即根据上面文本框的空与不空,即根据所输内容进行查询,这里的表达式生成如何生成
if edit1.text<>'' then query1.fieldbyname('xx1').asstring:=edit1.text;
if edit2.text<>'' then query1.fieldbyname('xx2').asstring:=edit2.text;
if edit3.text<>'' then query1.fieldbyname('xx3').asstring:=edit3.text;
if edit4.text<>'' then query1.fieldbyname('xx4').asstring:=edit4.text;
if edit5.text<>'' then query1.fieldbyname('xx5').asstring:=edit5.text;
 query1.sql.execute;
query1.open;
 
可惜,我两台相机都不支持时间,只能读文件存入硬盘时的时间。
 
来自:kinneng, 时间:2006-5-21 16:24:09, ID:3448875
可惜,我两台相机都不支持时间,只能。
-------不,你的肯定支持的,因为我一开始也不知道,后来用图像处理软件就能看得到其拍摄的日期和时间,也就是凡数码照片都有一个属性,在其fileinfo中就存有其拍摄的日期和时间。
  如果实在不行,那就用 读文件存入硬盘时的日期和时间吧
请告诉我如何获取日期和时间的完整代码好吗?
小妹妹我在此谢过了!!!!!
 
留下你的邮箱发给你我(hzjieking@163.com),把一些例程发给你或许对你有用!
 
图片文件都有文件头。和声音文件一样。相关信息都记录在文件头里。
然后才是数据。
 
返回日期时间:
var DT:TDateTime;
DT :=FileDateToDateTime(FileAge('C:/lsf.txt'));

匹配查询可以自己写一个函数,用途是组成一个SQL查询语句的内容
 
lsf520,高手大哥哥,你能帮我写个代码吗 ----第2个问题的  谢谢了

我的E_mail是wjsfish@sohu.com
 
用免费的 mdFileStream, mdJpegInfo pas,可以获取图片完整的exif信息
 
我也想知道
 
我的这个代码就能实现对任何一个的查询,你把里面的变量改一下,冗余去掉以后试一试
procedure Tmainfrm.Button1Click(Sender: TObject);
var
sqlstr:string;
JHRQ:string;
begin
DBgrid1.Font.Color:=clgreen;
JHRQ:=dateTOstr(datetimepicker1.Date);
sqlstr:='where (1=1)';
sqlstr:=sqlstr+' and (进货日期 like'''+'%'+dateTostr(dateTimepicker1.Date)+'%'')';
if CHXLB.Text <>'选择类别' then sqlstr:=sqlstr+'and (类型 like'''+'%'+CHXLB.text+'%'')' ;
if CHXMCH.Text <>'选择名称' then sqlstr:=sqlstr+'and (名称 like'''+'%'+CHXMCH.text+'%'')' ;
if CHXSHL.Text <>'选择数量' then sqlstr:=sqlstr+'and (进货数量 like'''+'%'+CHXSHL.text+'%'')' ;
begin
ADOQuery1.Close ;
ADOQuery1.SQL.Clear ;
ADOQuery1.SQL.Add('select * from 进货');
ADOQuery1.SQL.Add(sqlstr);
ADOQuery1.Open ;
CHXLB.Text:='选择类别';
CHXMCH.Text:='选择名称';
CHXSHL.Text:='选择数量';
end;
 
to ssssssss
好久没来这了,我已经发给你了,接收~~~~~~~~~~~

肯定对你有帮助的
 
Edit1.Text := DateTimeToStr(FileDateToDateTime(FileAge('e:/temp/password.txt')))

显示的完整时间啊: 2006-5-26 8:32:54
 
若只想显示日期用:DateToStr(FileDateToDateTime(FileAge('e:/temp/password.txt')))
显示时间用:TimeToStr(FileDateToDateTime(FileAge('e:/temp/password.txt')))
 
问题解决如下:
Procedure GetFileTimes( filename: String;
Var creationtime,
lastaccesstime,
lastwritetime: TFileTime);
var
Srec:TSearchRec;
systime:TSystemTime;
localtime:TFileTime;
begin
If FindFirst( filename, faAnyfile, Srec ) = 0 Then
try
With SRec.FindData Do
Begin
creationtime := ftCreationTime ;
lastaccesstime := ftLastAccessTime ;
lastwritetime := ftLastWriteTime ;
FileTimeToLocalFiletime(creationtime,localtime);
FileTimeToSystemTime(localtime,systime);
form1.Edit2.Text := inttostr(systime.wYear)+'-'+inttostr(systime.wMonth)+'-'+
inttostr(systime.wDay)+' '+inttostr(systime.wHour)+':'+
inttostr(systime.wMinute)+':'+inttostr(systime.wSecond);
FileTimeToLocalFiletime(lastaccesstime,localtime);
FileTimeToSystemTime(localtime,systime);
form1.Edit3.Text := inttostr(systime.wYear)+'-'+inttostr(systime.wMonth)+'-'+
inttostr(systime.wDay)+' '+inttostr(systime.wHour)+':'+
inttostr(systime.wMinute)+':'+inttostr(systime.wSecond);
FileTimeToLocalFiletime(lastwritetime,localtime);
FileTimeToSystemTime(localtime,systime);
form1.Edit6.Text := inttostr(lastwritetime.dwLowDateTime);
form1.Edit7.Text := inttostr(lastwritetime.dwHighDateTime);
form1.Edit4.Text := inttostr(systime.wYear)+'-'+inttostr(systime.wMonth)+'-'+
inttostr(systime.wDay)+' '+inttostr(systime.wHour)+':'+
inttostr(systime.wMinute)+':'+inttostr(systime.wSecond);
End;
finally
FindClose( SRec );
end
end;

我测试了,好使
 
幸福人生和sundata两位好心高手大哥哥好 你们是回答的第三个问题和第一个吗

在窗体中有5个文本框,无论在哪个框中输入内容,都可实现查询

取出相片的拍摄日期

我去试试啊
 
我回答的是第三个
 
后退
顶部