Changing File Properties

Hey...

Could someone explain how to change the creation date and time of a file..? I really dont have a clue on this..!

Thank you for any help give :)

Comments

  • : Could someone explain how to change the creation date and time of a
    : file..? I really dont have a clue on this..!

    http://www.scalabium.com/faq/dct0122.htm
  • [b][red]This message was edited by Smokedice at 2005-3-10 11:19:22[/red][/b][hr]
    Thanks very much, i actually found that page just after you posted..!

    I have found out how to change the date using:

    value := StrToDateTime('01/01/1900 00:00');

    Does anyone know why the file doesnt want to change to that date and time? This is the coding im using:

    [code]
    procedure TForm1.Button1Click(Sender: TObject);
    var
    hFile : THandle;
    FileName : string;
    Value : TDateTime;
    result : boolean;
    begin
    Filename := edit1.Text;
    value := StrToDateTime('01/01/1900 00:00');
    result := false;
    try
    {open a file handle}
    hFile := FileOpen(FileName, fmOpenWrite or fmShareDenyNone);

    {if opened succesfully}
    if (hFile > 0) then
    {convert a datetime into DOS format and set a date}
    Result := (FileSetDate(hFile, DateTimeToFileDate(Value)) = 0)
    finally
    {close an opened file handle}
    FileClose(hFile);
    end;
    if Result = true then
    showmessage('Changed To: '+datetimetostr(value))
    else
    showmessage('No Change');
    end;
    [/code]
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories