Autor Beitrag
Jakob Schöttl
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 929
Erhaltene Danke: 1


Delphi 7 Professional
BeitragVerfasst: Fr 06.10.06 19:23 
<SearchRec.FindData.ftLastAccessTime.dwLowDateTime TO STRING>

HI

Ich muss die letzte zugriffszeit von einigen dateien wissen. dazu hab ich SearchRec.FindData.ftLastAccessTime.dwLowDateTime genommen bzw. dwHightDateTime.

Jetzt weiß ich nur nciht, wie ich das in das normale DateTime und somit in einen Str konvertieren kann. Ich hab keine Konvertierungsfunktion gefunden.

Ich hoffe ihr könnt mir helfen!


Zuletzt bearbeitet von Jakob Schöttl am Sa 07.10.06 09:54, insgesamt 1-mal bearbeitet
Chryzler
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1097
Erhaltene Danke: 2



BeitragVerfasst: Fr 06.10.06 20:55 
Was für ein Typ ist denn dieses dwLowDateTime? In der Hilfe steht auch nix?
Jakob Schöttl Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 929
Erhaltene Danke: 1


Delphi 7 Professional
BeitragVerfasst: Sa 07.10.06 10:01 
Also, dwLowDateTime ist fast das gleiche wie dwHightDateTime; beide sind im Record ftLastAccessTime und haben den Typ Cardinal, also DoubleWord;
ausblenden Delphi-Quelltext
1:
2:
3:
4:
  _FILETIME = record
    dwLowDateTime: DWORD;
    dwHighDateTime: DWORD;
  end;


TSearchRec ist ja in der delphi-Hilfe noch referenziert, aber seine Records (plattformspezifisch) nicht.
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Sa 07.10.06 10:13 
In der Hilfe ist die Funktion FileDateToDateTime beschrieben. Schon gesehen?

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
Jakob Schöttl Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 929
Erhaltene Danke: 1


Delphi 7 Professional
BeitragVerfasst: Sa 07.10.06 10:21 
ja danke, aber die hab ich schon probiert, und da kam eine exception: "unerwartetes Format" oder so. Der parametertyp hat schon gestimmt, aber er konnte es habl nciht konvertieren
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Sa 07.10.06 10:24 
Ich hab es gerade ausprobiert, da kam keine Fehlermeldung o_O.

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
Jakob Schöttl Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 929
Erhaltene Danke: 1


Delphi 7 Professional
BeitragVerfasst: Sa 07.10.06 12:36 
Ich hab grad rausgefunden:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
//hier gibts einen Fehler
DateTimeToStr(FileDateToDateTime(SearchRec.FindData.ftLastAccessTime.dwHighDateTime))

//und hier nicht
DateTimeToStr(FileDateToDateTime(SearchRec.FindData.ftLastAccessTime.dwLowDateTime))

Ich hab also den niedrige n Zeitstempel genommen, aber da kommt was raus, was nicht sein kann, nähmlich als Jahr 1986. Das kann glaub ich nicht sein, weil ich die dateien vor 1 Jahr installiert hab.

und jetzt kam grad auch bei dem dwLowDateTime eine Exception: 'Ungültiges Argument zum zum Codieren des Datums' der Klasse EConvertError;
Jakob Schöttl Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 929
Erhaltene Danke: 1


Delphi 7 Professional
BeitragVerfasst: So 13.05.07 12:41 
ausblenden Delphi-Quelltext
1:
2:
SearchRec.FindData.ftLastAccessTime.dwHighDateTime
SearchRec.FindData.ftLastAccessTime.dwLowDateTime


Mir ist jetzt eingefallen, dass das Low und High zusammengehören. Das Nieder- und Höherwertige DoppelWort...

Aber wie man das konvertieren könnte weiß ich immer noch nicht.
Chryzler
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1097
Erhaltene Danke: 2



BeitragVerfasst: So 13.05.07 13:43 
Vielleicht geht das?
ausblenden Delphi-Quelltext
1:
  DateTimeToStr(FileDateToDateTime(SearchRec.FindData.ftLastAccessTime));					

Ansonsten musst du eben die High- und Low-Bytes zu einem zusammenfügen. Geht glaub ich ungefähr mit together := (High shl 32) + Low;
Jakob Schöttl Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 929
Erhaltene Danke: 1


Delphi 7 Professional
BeitragVerfasst: So 13.05.07 20:23 
aja, das könnte gehen, aber wenn ich "LastAccess" nehme, dann hab ich die letzte zugriffszeit und nciht die erstellungszeit.
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: So 13.05.07 21:32 
Dann nimm doch ftCreationTime.

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
Jakob Schöttl Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 929
Erhaltene Danke: 1


Delphi 7 Professional
BeitragVerfasst: Mo 14.05.07 14:13 
user profile iconGTA-Place hat folgendes geschrieben:
Dann nimm doch ftCreationTime.
ja, aber es ging ja darum den Record mit zwei DWORDs in eine gültige Zeit umzuwandeln.
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Mo 14.05.07 15:39 
Hallo,

so funktioniert es in meiner Anwendung:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
var LTime : TFileTime;
    SystemTime : TSystemTime;
begin
   //..
  FileTimeToLocalFileTime(SR.FindData.ftLastAccessTime, LTime);
  FileTimeToSystemTime(LTime, SystemTime); 
  showmessage(FormatDateTime('dd/mm/yyyy hh:nn:ss',SystemTimeToDateTime(SystemTime)));

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )