FILETIME? DosDateTimeToFileTime() ?
-
How do I create a new FILETIME for given date and time?
// pszDateTime like 12/3/2003 19:32 int day,month,year,hour,min = 0; sscanf(pszDateTime,"%d/%d/%d %d:%d",&day,&month,&year,&hour,&min); DOSTIME time; DOSDATE date; date.day = day; date.month = month; date.year = year - 1980; time.hour = hour; time.min = min; time.sec = 0; FILETIME fTime; if(**DosDateTimeToFileTime**(*(WORD*)&date,*(WORD*)&time,&fTime)==0) return -1;
Problem is DosDateTimeToFileTime() always fails. I want a FILETIME that I could compare with using CompareFileTime(). TIA. :)Hush,hush... thought I heard you call my name now. Kula Shaker. Amit Dey Latest articles at CP -
Writing Word addins Office addin -
How do I create a new FILETIME for given date and time?
// pszDateTime like 12/3/2003 19:32 int day,month,year,hour,min = 0; sscanf(pszDateTime,"%d/%d/%d %d:%d",&day,&month,&year,&hour,&min); DOSTIME time; DOSDATE date; date.day = day; date.month = month; date.year = year - 1980; time.hour = hour; time.min = min; time.sec = 0; FILETIME fTime; if(**DosDateTimeToFileTime**(*(WORD*)&date,*(WORD*)&time,&fTime)==0) return -1;
Problem is DosDateTimeToFileTime() always fails. I want a FILETIME that I could compare with using CompareFileTime(). TIA. :)Hush,hush... thought I heard you call my name now. Kula Shaker. Amit Dey Latest articles at CP -
Writing Word addins Office addinWithout knowing what
DOSDATE
/DOSTIME
are I can't say. But since you have the month/day/year/hour/minute already separated, just fill in aSYSTEMTIME
and callSystemTimeToFileTime()
. --Mike-- Ericahist | CP SearchBar v2.0.2 | Homepage | RightClick-Encrypt | 1ClickPicGrabber Actual sign at the laundromat I go to: "No tinting or dying." -
Without knowing what
DOSDATE
/DOSTIME
are I can't say. But since you have the month/day/year/hour/minute already separated, just fill in aSYSTEMTIME
and callSystemTimeToFileTime()
. --Mike-- Ericahist | CP SearchBar v2.0.2 | Homepage | RightClick-Encrypt | 1ClickPicGrabber Actual sign at the laundromat I go to: "No tinting or dying."Mike,A big hello.:) sorry I missed that part. DOSDATE and DOSTIME structs looks like:
typedef struct DOSDATE { WORD day; WORD month; WORD year; }DOSDATE; typedef struct DOSTIME { WORD hour; WORD min; WORD sec; }DOSTIME;
But I cann't seem to get it right.:confused:Hush,hush... thought I heard you call my name now. Kula Shaker. Amit Dey Latest articles at CP -
Writing Word addins Office addin -
Mike,A big hello.:) sorry I missed that part. DOSDATE and DOSTIME structs looks like:
typedef struct DOSDATE { WORD day; WORD month; WORD year; }DOSDATE; typedef struct DOSTIME { WORD hour; WORD min; WORD sec; }DOSTIME;
But I cann't seem to get it right.:confused:Hush,hush... thought I heard you call my name now. Kula Shaker. Amit Dey Latest articles at CP -
Writing Word addins Office addinWell, casting a
DOSDATE
to aWORD
won't do you any good, since aDOSDATE
is not aWORD
, nor is it packed into aWORD
as described in the docs forDosDateTimeToFileTime()
. You'll need to pack them yourself, or do some trickery with the structs, maybe this (note: untested):typedef struct DOSDATE
{
unsigned day : 5;
unsigned month : 4;
unsigned year : 7;
} DOSDATE;typedef struct DOSTIME
{
unsigned hour : 5;
unsigned min : 6;
unsigned sec : 5;
} DOSTIME;--Mike-- Ericahist | CP SearchBar v2.0.2 | Homepage | RightClick-Encrypt | 1ClickPicGrabber If my rhyme was a drug, I'd sell it by the gram.