Einzelnen Beitrag anzeigen

Benutzerbild von mirage228
mirage228

Registriert seit: 23. Mär 2003
Ort: Münster
3.750 Beiträge
 
Delphi 2010 Professional
 
#4

Re: Erweiterte Dateiinformationen schreiben

  Alt 15. Apr 2004, 13:06
Zitat von Luckie:
Wie wäre es mit denen hier:
Delphi-Quellcode:
  OleCheck(StgOpenStorageEx(PWideChar(FileName),
  STGM_READ or STGM_SHARE_DENY_WRITE,
  STGFMT_FILE,
  0, nil, nil, @IID_IPropertySetStorage, stg));

  PropSetStg := Stg as IPropertySetStorage;

  OleCheck(PropSetStg.Open(FmtID_SummaryInformation,
     STGM_READ or STGM_SHARE_EXCLUSIVE, PropStg));

  OleCheck(PropStg.Enum(PropEnum));
Und der Schleife:
Delphi-Quellcode:
  hr := PropEnum.Next(1, PropStat, nil);
   while hr = S_OK do
   begin
     inc(I);
     SetLength(PropSpec,I);
     PropSpec[i-1].ulKind := PRSPEC_PROPID;
     PropSpec[i-1].propid := PropStat.propid;
     hr := PropEnum.Next(1, PropStat, nil);
  end;
Hi,
hier einige Erklärungen
  • OleCheck löst eine EOleSysError-Exception aus, wenn der Ergebniscode einen Fehler anzeigt. (siehe OH)
  • PropSetStg := Stg as IPropertySetStorage -> Stg wird zum Interface IPropertySetStorage gecastet (ist wahrs. vorher IInterface) ("To get a pointer to the NTFS implementation of IPropertySetStorage, we have to call the StgCreateStorageEx function:")
  • Die Schleife wird sooft wiederholt, bis PropEnum.Next nicht Ok zurückgibt, sprich es keine Eigenschaften mehr zu setzten gibt.

mfG
mirage228
David F.

May the source be with you, stranger.
PHP Inspection Unit (Delphi-Unit zum Analysieren von PHP Code)
  Mit Zitat antworten Zitat