On Wednesday, 9 September 2020 at 22:44:50 UTC, FreeSlave wrote:
Btw do you know how to parse a date returned by GetDetailsOf? Couldn't find any examples in C++. I actually can see digits representing date and time as a part of the string, but I would prefer to use some winapi function to translate it into some time type instead of manually parsing the result.

You could look at passing the str.pOleStr field in the SHELLDETAILS you got from GetDetailsOf to VarDateFromStr. It will give you a DATE value that VariantTimeToSystemTime will convert to a SYSTEMTIME from which you can get the years, months, days etc.

For example:

SHELLDETAILS details;
GetDetailsOf(pidl, 3, &details);
DATE date;
VarDateFromStr(details.str.pOleStr, LOCALE_USER_DEFAULT, 0, &date);
SYSTEMTIME st;
VariantTimeToSystemTime(date, &st);
auto year = st.wYear;
auto month = st.wMonth;

You can convert that into a more D-friendly SysTime object using SYSTEMTIMEToSysTime from the std.datetime package.

Reply via email to