Retrieving 'photo taken time' from c++ program

Have been using C++ to successfully retrieve and use info from WIN32_FIND_DATA data structure for various reasons. Now have many files that are photos and which show up in Windows Explorer sortable by the time the photo was taken - but I need to programmatically sort them and can not find out how to get to the 'photo taken time' within a program. Running under Windows7. Any suggestions?
If you're working with Win32, then the system doesn't automatically provide this info (unless it's appeared in Windows 8 ?), so you need to read the metadata from the image file yourself.

One poss. is Gdi+

Reading and Writing Metadata (Windows)
http://msdn.microsoft.com/en-us/library/windows/desktop/ms533832%28v=vs.85%29.aspx

The ID of the property you're prob. interested in is:

PropertyTagExifDTOrig

Date and time when the original image data was generated. For a DSC, the date and time when the picture was taken. The format is YYYY:MM:DD HH:MM:SS with time shown in 24-hour format and the date and time separated by one blank character (0x2000). The character string length is 20 bytes including the NULL terminator. When the field is empty, it is treated as unknown.

From: Property Item Descriptions (Windows)
http://msdn.microsoft.com/en-us/library/windows/desktop/ms534416%28v=vs.85%29.aspx

Other possibilies include 3rd party libraries (e.g. http://libexif.sourceforge.net/) and the equivalent .Net approach (the BitmapMetadata class)), if you're into C++/CLI

Andy
Last edited on
Thanks for the input - I'll review your first link, looks promising
Topic archived. No new replies allowed.