For those still looking you can try Scott's answer. Here's how I did it using the ATLComTime.h library which takes a few more steps.
FileTime fileTime = yourFileTime;
// dateFileTime will automatically cast to DATE when used as a parameter
COleDateTime dateFileTime(fileTime);
Since DATE is a COM friendly type you can simply give the 'dateFileTime' variable as a method parameter. If you still want to use the VARIANT simply set the 'dateFileTime' variable into a VARIANT.
VARIANT varDate;
VariantInit(&varDate);
varDate.vt = VT_DATE;
varDate.date = dateFileTime;
// Use the varDate varaible
// ... call some method or use locally
// Don't forget to clear the VARIANT from memory after use
VariantClear(&varDate);
In the called method (still in C++), ie getting the FILETIME back from a DATE variable.
The COleDateTime wants to give you a SYSTEMTIME instead of a FILETIME so we have to jump through a few hoops.
FILETIME fileTime;
if (variantDateTime.vt == VT_DATE) // only use if DATE was put into a VARIANT
{
COleDateTime oleDateTime(variantDateTime.date);
SYSTEMTIME sysTime;
oleDateTime.GetAsSystemTime(sysTime);
SystemTimeToFileTime(&sysTime, &fileTime);
}
If you didn't use a VARIANT you can just initialize the COleDateTime type with the DATE variable.
COleDateTime oleDateTime(dateVariable);
... // etc as above
As stated above it's a bit more work than Scotts answer, but is another way to get a FILETIME across the COM interface barrier.