CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
花落谁家,你作主! 盛大widget设计大赛英雄榜
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  VB >  API

高手帮忙解决一个难题,在线等,解决马上给分

楼主lei13(雷)2005-06-02 09:52:33 在 VB / API 提问

现有这样一个问题.用数码相机照的像片放在电脑里,在它的属性里有拍照的日期,怎么能取到拍照的日期?用VB实现. 问题点数:0、回复次数:6Top

1 楼lei13(雷)回复于 2005-06-02 09:56:51 得分 0

这个日期属性只能在XP下看到.在2000下看不到.Top

2 楼xinliangyu(yxl)回复于 2005-06-02 10:02:43 得分 0

是不是文件创建日期呢?我没用过数码像机Top

3 楼DooDu(杜霖:I want,I can(开关拉))回复于 2005-06-02 10:03:53 得分 0

【VB声明】  
      Private   Declare   Function   GetFileTime   Lib   "kernel32"   Alias   "GetFileTime"   (ByVal   hFile   As   Long,   lpCreationTime   As   FILETIME,   lpLastAccessTime   As   FILETIME,   lpLastWriteTime   As   FILETIME)   As   Long  
   
  【说明】  
      取得指定文件的时间信息    
   
  【返回值】  
      Long,非零表示成功,零表示失败。会设置GetLastError    
   
  【备注】  
      如果不需要特定的信息,那么lpCreationTime,lpLastAccessTime,lpLastWriteTime都可以设置为零(用ByVal  
      As   Long)。这个函数返回的文件时间采用UTC格式  
   
  【参数表】  
      hFile   ----------     Long,文件的句柄  
   
      lpCreationTime   -     FILETIME,用于装载文件的创建时间  
   
      lpLastAccessTime   -     FILETIME,用于装载文件上一次访问的时间(FAT文件系统不支持这一特性)  
   
      lpLastWriteTime   -     FILETIME,用于装载文件上一次修改的时间  
   
   
  ==========================  
   
   
  'This   program   needs   a   Dialog   box,   named   CDBox1  
  '     (To   add   the   Common   Dialog   Box   to   your   tools   menu,   go   to   Project->Components   (or   press   CTRL-T)  
  '       and   select   Microsoft   Common   Dialog   control)  
  Private   Type   FILETIME  
          dwLowDateTime   As   Long  
          dwHighDateTime   As   Long  
  End   Type  
  Private   Type   SHFILEOPSTRUCT  
          hWnd   As   Long  
          wFunc   As   Long  
          pFrom   As   String  
          pTo   As   String  
          fFlags   As   Integer  
          fAborted   As   Boolean  
          hNameMaps   As   Long  
          sProgress   As   String  
  End   Type  
  Private   Type   SYSTEMTIME  
          wYear   As   Integer  
          wMonth   As   Integer  
          wDayOfWeek   As   Integer  
          wDay   As   Integer  
          wHour   As   Integer  
          wMinute   As   Integer  
          wSecond   As   Integer  
          wMilliseconds   As   Integer  
  End   Type  
  Private   Const   GENERIC_WRITE   =   &H40000000  
  Private   Const   OPEN_EXISTING   =   3  
  Private   Const   FILE_SHARE_READ   =   &H1  
  Private   Const   FILE_SHARE_WRITE   =   &H2  
  Private   Const   FO_DELETE   =   &H3  
  Private   Declare   Function   CopyFile   Lib   "kernel32"   Alias   "CopyFileA"   (ByVal   lpExistingFileName   As   String,   ByVal   lpNewFileName   As   String,   ByVal   bFailIfExists   As   Long)   As   Long  
  Private   Declare   Function   CreateDirectory   Lib   "kernel32"   Alias   "CreateDirectoryA"   (ByVal   lpPathName   As   String,   lpSecurityAttributes   As   Long)   As   Long  
  Private   Declare   Function   DeleteFile   Lib   "kernel32"   Alias   "DeleteFileA"   (ByVal   lpFileName   As   String)   As   Long  
  Private   Declare   Function   GetFileSize   Lib   "kernel32"   (ByVal   hFile   As   Long,   lpFileSizeHigh   As   Long)   As   Long  
  Private   Declare   Function   GetFileTime   Lib   "kernel32"   (ByVal   hFile   As   Long,   lpCreationTime   As   FILETIME,   lpLastAccessTime   As   FILETIME,   lpLastWriteTime   As   FILETIME)   As   Long  
  Private   Declare   Function   MoveFile   Lib   "kernel32"   Alias   "MoveFileA"   (ByVal   lpExistingFileName   As   String,   ByVal   lpNewFileName   As   String)   As   Long  
  Private   Declare   Function   CreateFile   Lib   "kernel32"   Alias   "CreateFileA"   (ByVal   lpFileName   As   String,   ByVal   dwDesiredAccess   As   Long,   ByVal   dwShareMode   As   Long,   lpSecurityAttributes   As   Long,   ByVal   dwCreationDisposition   As   Long,   ByVal   dwFlagsAndAttributes   As   Long,   ByVal   hTemplateFile   As   Long)   As   Long  
  Private   Declare   Function   CloseHandle   Lib   "kernel32"   (ByVal   hObject   As   Long)   As   Long  
  Private   Declare   Function   SHFileOperation   Lib   "shell32.dll"   Alias   "SHFileOperationA"   (lpFileOp   As   SHFILEOPSTRUCT)   As   Long  
  Private   Declare   Function   FileTimeToSystemTime   Lib   "kernel32"   (lpFileTime   As   FILETIME,   lpSystemTime   As   SYSTEMTIME)   As   Long  
  Private   Declare   Function   FileTimeToLocalFileTime   Lib   "kernel32"   (lpFileTime   As   FILETIME,   lpLocalFileTime   As   FILETIME)   As   Long  
  Private   Sub   Form_Load()  
          'KPD-Team   1998  
          'URL:   http://www.allapi.net/  
          'E-Mail:   KPDTeam@Allapi.net  
          Dim   lngHandle   As   Long,   SHDirOp   As   SHFILEOPSTRUCT,   lngLong   As   Long  
          Dim   Ft1   As   FILETIME,   Ft2   As   FILETIME,   SysTime   As   SYSTEMTIME  
          'Set   the   dialog's   title  
          CDBox.DialogTitle   =   "Choose   a   file   ..."  
          'Raise   an   error   when   the   user   pressed   cancel  
          CDBox.CancelError   =   True  
          'Show   the   'Open   File'-dialog  
          CDBox.ShowOpen  
          'Create   a   new   directory  
          CreateDirectory   "C:\KPD-Team",   ByVal   &H0  
          'Copy   the   selected   file   to   our   new   directory  
          CopyFile   CDBox.filename,   "C:\KPD-Team\"   +   CDBox.FileTitle,   0  
          'Rename   the   file  
          MoveFile   "C:\KPD-Team\"   +   CDBox.FileTitle,   "C:\KPD-Team\test.kpd"  
          'Open   the   file  
          lngHandle   =   CreateFile("C:\KPD-Team\test.kpd",   GENERIC_WRITE,   FILE_SHARE_READ   Or   FILE_SHARE_WRITE,   ByVal   0&,   OPEN_EXISTING,   0,   0)  
          'Get   the   file's   size  
          MsgBox   "The   size   of   the   selected   file   is"   +   Str$(GetFileSize(lngHandle,   lngLong))   +   "   bytes."  
          'Get   the   fil's   time  
          GetFileTime   lngHandle,   Ft1,   Ft1,   Ft2  
          'Convert   the   file   time   to   the   local   file   time  
          FileTimeToLocalFileTime   Ft2,   Ft1  
          'Convert   the   file   time   to   system   file   time  
          FileTimeToSystemTime   Ft1,   SysTime  
          MsgBox   "The   selected   file   was   created   on"   +   Str$(SysTime.wMonth)   +   "/"   +   Ltrim(Str$(SysTime.wDay))   +   "/"   +   Ltrim(Str$(SysTime.wYear))  
          'Close   the   file  
          CloseHandle   lngHandle  
          'Delete   the   file  
          DeleteFile   "C:\KPD-Team\test.kpd"  
          With   SHDirOp  
                  .wFunc   =   FO_DELETE  
                  .pFrom   =   "C:\KPD-Team"  
          End   With  
          'Delete   the   directory  
          SHFileOperation   SHDirOp  
          End  
  End   Sub  
  Top

4 楼lei13(雷)回复于 2005-06-02 10:05:37 得分 0

不是创建日期,是拍照的日期,这二个日期不是一样的.Top

5 楼TechnoFantasy((VB MVP)www.applevb.com)回复于 2005-06-02 15:22:12 得分 0

Accessing   Extra   Image   Information   in   JPEG   Files:  
   
  http://msdn.microsoft.com/library/en-us/dnhcvb04/html/vb04b15.asp?frame=trueTop

6 楼LuBingLin(为什么?)回复于 2005-06-02 16:02:32 得分 0

我晕,楼上的星星什么时候会掉,我捡个用!!!Top

相关问题

  • [在线等,急]超级难题,请版主关注,解决马上给分!!!
  • update语句难题?????????????????????????马上结分!!!!!!
  • 难题,分不够可以再加,解决了马上给分,请各位高手指教,在线等候。
  • Excel 难题!100分!在线等,谢谢!
  • 难题!难题!!(100分)
  • 线程难题
  • 难题!300分
  • 多分难题
  • 难题-------高分!!!!!!!!!!!
  • 难题高分

关键词

  • .net
  • 文件
  • filetime
  • lplastaccesstime
  • lpcreationtime
  • lplastwritetime
  • 用于装载
  • integ
  • dialog
  • long

得分解答快速导航

  • 帖主:lei13

相关链接

  • Visual Basic类图书
  • Visual Basic类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo