ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ¦p¦ó¥ÎVBA§å¦¸¶}±ÒJPGÀɨæsÀÉ¡H

[µo°Ý] ¦p¦ó¥ÎVBA§å¦¸¶}±ÒJPGÀɨæsÀÉ¡H

½Ð±Ð¦U¦ì«e½ú°ª¤â¡A¦]¤u§@¤W»Ý­n¡A§Ú·Q­n¼g¤@­ÓVBAµ{¦¡
¥i¥H¶}±Ò¬Y­Ó¸ê®Æ§¨¤Uªº©Ò¦³JPG¹ÏÀÉ(¤£ª¾¹D¯à¤£¯à¥Î*.jpg)¡A¨Ã¥Ñµ{¦¡½X§P©w§äµLÀÉ®×´N°±¤î(À³¸Ó¬O­n¼g°j°é)
µM«á±N¨C­Ó¶}±ÒªºÀɮצsÀɨÃÃö³¬¡A¤£»ÝÅܧóÀɦW
¦sÀɪº¥Øªº¥u¬O¬°¤F±NÀɮתº­×§ï¤é´ÁÅܦ¨¤µ¤é
¤£ª¾¹Dµ{¦¡½XÀ³¸Ó«ç»ò¼g¡AÀµ½Ð¦U¦ì«ü¾É¤@¤U¡A·P®¦¡C
¨Ò¡GC¼Ñªºpic¸ê®Æ§¨¤¤¦³1,2,3,4,5 JPGÀÉ
§Ú·Q±NC:\pic\1.jpg¡BC:\pic\2.jpg¡BC:\pic\3.jpg¡BC:\pic\4.jpg¡BC:\pic\5.jpg
¥þ³£¶}±Ò¨Ã¦sÀɤ@¦¸

¦^´_ 1# smart3135
«á¨Óª¦¤å¦³§ä¨ì³o­Ó¡A¥i¥H§å¦¸ÅܧóÀɮ׳̫á­×§ï®É¶¡
¤£¹L·|³s«Ø¥ß®É¶¡»P¦s¨ú®É¶¡¤@°_Åܧó
¤£ª¾¹D¯à¤£¯à³æ¯Â¥uÅܧóÀɮ׳̫á­×§ï®É¶¡¡A¥t¥~¨â­Ó®É¶¡¤£¥h°Ê¨ì
  1. 'Àɮ׮ɶ¡Åª¨ú¡B³]©wªº API ¤Î±`¼Æ«Å§i
  2. Private Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" (ByVal lpFileName As String, ByVal dwDesiredAccess As Long, ByVal dwShareMode As Long, ByVal lpSecurityAttributes As Long, ByVal dwCreationDisposition As Long, ByVal dwFlagsAndAttributes As Long, ByVal hTemplateFile As Long) As Long
  3. Private Declare Function GetFileTime Lib "kernel32" (ByVal hFile As Long, lpCreationTime As FileTime, lpLastAccessTime As FileTime, lpLastWriteTime As FileTime) As Long
  4. Private Declare Function SetFileTime Lib "kernel32" (ByVal hFile As Long, lpCreationTime As FileTime, lpLastAccessTime As FileTime, lpLastWriteTime As FileTime) As Long
  5. Private Declare Function SystemTimeToFileTime Lib "kernel32" (lpSystemTime As SYSTEMTIME, lpFileTime As FileTime) As Long
  6. Private Declare Function FileTimeToSystemTime Lib "kernel32" (lpFileTime As FileTime, lpSystemTime As SYSTEMTIME) As Long
  7. Private Declare Function LocalFileTimeToFileTime Lib "kernel32" (lpLocalFileTime As FileTime, lpFileTime As FileTime) As Long
  8. Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long

  9. Private Const GENERIC_WRITE = &H40000000
  10. Private Const OPEN_EXISTING = 3
  11. Private Const FILE_SHARE_READ = &H1
  12. Private Const FILE_SHARE_WRITE = &H2

  13. Private Type SYSTEMTIME
  14.     wYear As Integer
  15.     wMonth As Integer
  16.     wDayOfWeek As Integer
  17.     wDay As Integer
  18.     wHour As Integer
  19.     wMinute As Integer
  20.     wSecond As Integer
  21.     wMilliseconds As Integer
  22. End Type

  23. Private Type FileTime
  24.     dwLowDateTime As Long
  25.     dwHighDateTime As Long
  26. End Type

  27. '¨ú±oÀɮ׮ɶ¡
  28. Private Function GetTime(f As String, t1 As FileTime, t2 As FileTime, t3 As FileTime)
  29.     lngHandle = CreateFile(f, GENERIC_WRITE, FILE_SHARE_READ Or FILE_SHARE_WRITE, ByVal 0&, OPEN_EXISTING, 0, 0)
  30.     GetFileTime lngHandle, t1, t1, t2
  31.     CloseHandle lngHandle
  32. End Function

  33. '³]©wÀɮ׮ɶ¡
  34. Private Function SetTime(f As String, t1 As FileTime, t2 As FileTime, t3 As FileTime)
  35.     lngHandle = CreateFile(f, GENERIC_WRITE, FILE_SHARE_READ Or FILE_SHARE_WRITE, ByVal 0&, OPEN_EXISTING, 0, 0)
  36.     SetFileTime lngHandle, t1, t1, t2
  37.     CloseHandle lngHandle
  38. End Function

  39. Private Sub Command1_Click()

  40.     Dim ÀɦW As String
  41.     Dim ·s¤é´Á®É¶¡ As Date
  42.     Dim Àɮ׫إ߮ɶ¡ As FileTime
  43.     Dim ³Ì«áŪ¨ú®É¶¡ As FileTime
  44.     Dim ³Ì«á­×§ï®É¶¡ As FileTime
  45.     Dim tmp As SYSTEMTIME
  46.    
  47.     ·s¤é´Á®É¶¡ = Now                    '<-----------¹w³]Àɮ׮ɶ¡¬°·í¤U
  48.     ¸ô®| = "d:\tmp\"                    '<-----------ÀɮשҦbªº¸ê®Æ§¨
  49.     ÀÉ®×Ãþ«¬ = "*.*"                  '<-----------¿ï¨úªºÀÉ®×Ãþ«¬
  50.    
  51.     tmp.wYear = Year(·s¤é´Á®É¶¡)
  52.     tmp.wMonth = Month(·s¤é´Á®É¶¡)
  53.     tmp.wDay = Day(·s¤é´Á®É¶¡)
  54.     tmp.wHour = Hour(·s¤é´Á®É¶¡)
  55.     tmp.wMinute = Minute(·s¤é´Á®É¶¡)
  56.     tmp.wSecond = Second(·s¤é´Á®É¶¡)
  57.     tmp.wMilliseconds = 0
  58.    
  59.     SystemTimeToFileTime tmp, Àɮ׫إ߮ɶ¡
  60.     LocalFileTimeToFileTime Àɮ׫إ߮ɶ¡, Àɮ׫إ߮ɶ¡
  61.    
  62.     ³Ì«áŪ¨ú®É¶¡ = Àɮ׫إ߮ɶ¡         '<-----------§â¤T­Ó®É¶¡³£³]¦¨¤@­P
  63.     ³Ì«á­×§ï®É¶¡ = Àɮ׫إ߮ɶ¡
  64.    
  65.     SetTime ÀɦW, Àɮ׫إ߮ɶ¡, ³Ì«áŪ¨ú®É¶¡, ³Ì«á­×§ï®É¶¡
  66.    
  67.     '¶i¦æ§ó§ï
  68.     ÀɦW = Dir(¸ô®| & ÀÉ®×Ãþ«¬, vbNormal Or vbArchive Or vbReadOnly)
  69.     Do While ÀɦW <> ""
  70.         SetTime ¸ô®| & ÀɦW, Àɮ׫إ߮ɶ¡, ³Ì«áŪ¨ú®É¶¡, ³Ì«á­×§ï®É¶¡
  71.         ÀɦW = Dir
  72.     Loop
  73.    
  74. End Sub
½Æ»s¥N½X

TOP

        ÀR«ä¦Û¦b : ¥@¤W¦³¨â¥ó¨Æ¤£¯àµ¥¡G¤@¡B§µ¶¶ ¤G¡B¦æµ½¡C
ªð¦^¦Cªí ¤W¤@¥DÃD