delphi - FileAge is not working with "c:\pagefile.sys" -


does know why fileage not working "c:\pagefile.sys"? returns -1.

update:
found it: delphi bug fixed in delphi 2010 (qc entry 73539), the pdf have found not explain how fix it.

does know how fix can fix delphi 7?

update: elegant fix provided radu barbu!


delphi 7, win 7 (32 bits)

try this:

with variable of type tsearchrec (wsr bellow) load pagefile.sys

wsr.finddata.ftlastwritetime - should return when file accessed

and function bellow should time

function filetime2datetime(filetime: tfiletime): tdatetime; var   localfiletime     : tfiletime;   systemtime        : tsystemtime; begin   result := 0;   try     filetimetolocalfiletime(filetime, localfiletime);     filetimetosystemtime(localfiletime, systemtime);     result := systemtimetodatetime(systemtime);   except on e: exception //some message if want   end; end; 

best regards,


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -