WIA to find photos on camera/iPad and copy- issue with code

Posted on 2011-04-23
Last Modified: 2012-06-21
I have successfully used the code below to find photos on my iPad that are between a dat range.

However, when the photos are copied to a folder onmy hard drive, they end up with the date and time that they were copied, not when they were taken or 'created'.

I've viewed both the 'Modified' and 'Created' dates and both are the copied date and time.

If I access the iPad directly and then highlight/copy these same photos, the modified/created date/time are the correct

'loop trough all (root) items in the camera device
    For Each itm In d.Items
    Dim f As Properties
    Set f = itm.Properties
    Dim str As String
    lCounter = lCounter + 1
            strHold = ""
            Name = d.Items(lCounter).Properties("Item Name").Value
            Ext = d.Items(lCounter).Properties("Filename extension").Value
            Set v = d.Items(lCounter).Properties("Item Time Stamp").Value
            PhotoDate = Format(v.Date, "mm/dd/yyyy")
            'Debug.Print "Photo Number " & Format(i, "##0") & "  Name: " & Name & "." & Ext & "  Date taken: " & PhotoDate

           If IsBetween(PhotoDate, dtDateFrom, dtDateTo) Then
                'download the file to a temp buffer
                Set imgpic = itm.Transfer
                'store the file name and extension and app.path in a string,
                'so you can use it to perform more operations on it
                str = App.Path & "\downloaded images\" & Name & "." & Ext

                imgpic.SaveFile str
           End If

Open in new window

Question by:scbdpm

    Author Comment

    LVL 19

    Expert Comment


    Author Comment

    not sure how this applies.....
    LVL 19

    Accepted Solution

    You need to change file time after you save your files to disk ("imgpic.SaveFile str")

    1) Create variable with type SYSTEMTIME. Assign to value of v.Date
    Dim dSysTime as SYSTEMTIME
    dSysTime.wYear = Year(v.Date)
    ... and so on ...

    2) Convert SYSTIME to FILETIME
    Dim dFileTime as FILETIME
    SystemTimeToFileTime(dSysTime, dFileTime)

    3) Get a handle to your file
    Dim hFile As Long
    hFile = OpenFile(str, OFS, OF_READWRITE)

    4) Change file time
    SetFileTime(hFile, dFileTime, dFileTime, dFileTime)
    LVL 100

    Expert Comment

    This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
    You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now