Ver Mensaje Individual
  #3  
Antiguo 09-06-2006
Avatar de Sotrono
Sotrono Sotrono is offline
Miembro
 
Registrado: abr 2004
Ubicación: Buenos Aires - Argentina
Posts: 396
Reputación: 21
Sotrono Va por buen camino
Un ejemplo de su utilización:

Código Delphi [-]
//Sacado de www.swissdelphicenter.ch
//Autor Simon Grossenbacher 

function SetFileDateTime(FileName: string; NewDateTime: TDateTime): Boolean;
var
  FileHandle: Integer;
  FileTime: TFileTime;
  LFT: TFileTime;
  LST: TSystemTime;
begin
  Result := False;
  try
    DecodeDate(NewDateTime, LST.wYear, LST.wMonth, LST.wDay);
    DecodeTime(NewDateTime, LST.wHour, LST.wMinute, LST.wSecond, LST.wMilliSeconds);
    if SystemTimeToFileTime(LST, LFT) then
    begin
      if LocalFileTimeToFileTime(LFT, FileTime) then
      begin
        FileHandle := FileOpen(FileName, fmOpenReadWrite or
          fmShareExclusive);
        if SetFileTime(FileHandle, nil, nil, @FileTime) then
          Result := True;
      end;
    end;
  finally
    FileClose(FileHandle);
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  if OpenDialog1.Execute then
    if SetFileDateTime(OpenDialog1.FileName, now) then
      ShowMessage('Date set to now !');
end;
Responder Con Cita