Einzelnen Beitrag anzeigen

Benutzerbild von sakura
sakura

Registriert seit: 10. Jun 2002
Ort: Unterhaching
11.412 Beiträge
 
Delphi 12 Athens
 
#2
  Alt 19. Dez 2002, 15:53
Hier die gewünschte Lösung
Delphi-Quellcode:
uses
  ActiveX, ComObj;

procedure GetDocInfo(aFileName: String; Lines: TStrings);
const
  FMTID_SummaryInformation: TGUID = '{F29F85E0-4FF9-1068-AB91-08002B27B3D9}';
type
  TPropSpecArray = array[0..1000] of TPropSpec;
  PPropSpecArray = ^TPropSpecArray;
  TPropVariantArray = array[0..1000] of TPropVariant;
  PPropVariantArray = ^TPropVariantArray;
var
  stgRoot: IStorage;
  stgPS: IPropertySetStorage;
  stgP: IPropertyStorage;
  ps: PPropSpecArray;
  pv: PPropVariantArray;
begin
  Lines.Clear;
  OleCheck(StgOpenStorage(PWideChar(WideString(aFileName)), nil, STGM_READ or
      STGM_SHARE_EXCLUSIVE, nil, 0, stgRoot));
  stgPS := stgRoot as IPropertySetStorage;
  OleCheck(stgPS.Open(FMTID_SummaryInformation, STGM_READ or
      STGM_SHARE_EXCLUSIVE, stgP));
  ps := nil;
  pv := nil;
  GetMem(ps, SizeOf(TPropSpecArray));
  GetMem(pv, SizeOf(TPropVariantArray));
  try
    ps[0].ulKind := PRSPEC_PROPID;
    ps[0].propid := PIDSI_TITLE;
    ps[1].ulKind := PRSPEC_PROPID;
    ps[1].propid := PIDSI_COMMENTS;
    ps[2].ulKind := PRSPEC_PROPID;
    ps[2].propid := PIDSI_AUTHOR;
    OleCheck(stgP.ReadMultiple(3, @ps[0], @pv[0]));
    Lines.Add('Titel: ' + pv[0].pszVal);
    Lines.Add('Kommentar: ' + pv[1].pszVal);
    Lines.Add('Autor: ' + pv[2].pszVal);
  finally
    FreeMem(ps);
    FreeMem(pv);
  end;
end;
weitere Werte für propid
Code:
const
  // Property IDs for the SummaryInformation Property Set
  {$EXTERNALSYM PIDSI_TITLE}
  PIDSI_TITLE              = $00000002; // VT_LPSTR
  {$EXTERNALSYM PIDSI_SUBJECT}
  PIDSI_SUBJECT            = $00000003; // VT_LPSTR
  {$EXTERNALSYM PIDSI_AUTHOR}
  PIDSI_AUTHOR             = $00000004; // VT_LPSTR
  {$EXTERNALSYM PIDSI_KEYWORDS}
  PIDSI_KEYWORDS           = $00000005; // VT_LPSTR
  {$EXTERNALSYM PIDSI_COMMENTS}
  PIDSI_COMMENTS           = $00000006; // VT_LPSTR
  {$EXTERNALSYM PIDSI_TEMPLATE}
  PIDSI_TEMPLATE           = $00000007; // VT_LPSTR
  {$EXTERNALSYM PIDSI_LASTAUTHOR}
  PIDSI_LASTAUTHOR         = $00000008; // VT_LPSTR
  {$EXTERNALSYM PIDSI_REVNUMBER}
  PIDSI_REVNUMBER          = $00000009; // VT_LPSTR
  {$EXTERNALSYM PIDSI_EDITTIME}
  PIDSI_EDITTIME           = $0000000a; // VT_FILETIME (UTC)
  {$EXTERNALSYM PIDSI_LASTPRINTED}
  PIDSI_LASTPRINTED        = $0000000b; // VT_FILETIME (UTC)
  {$EXTERNALSYM PIDSI_CREATE_DTM}
  PIDSI_CREATE_DTM         = $0000000c; // VT_FILETIME (UTC)
  {$EXTERNALSYM PIDSI_LASTSAVE_DTM}
  PIDSI_LASTSAVE_DTM       = $0000000d; // VT_FILETIME (UTC)
  {$EXTERNALSYM PIDSI_PAGECOUNT}
  PIDSI_PAGECOUNT          = $0000000e; // VT_I4
  {$EXTERNALSYM PIDSI_WORDCOUNT}
  PIDSI_WORDCOUNT          = $0000000f; // VT_I4
  {$EXTERNALSYM PIDSI_CHARCOUNT}
  PIDSI_CHARCOUNT          = $00000010; // VT_I4
  {$EXTERNALSYM PIDSI_THUMBNAIL}
  PIDSI_THUMBNAIL          = $00000011; // VT_CF
  {$EXTERNALSYM PIDSI_APPNAME}
  PIDSI_APPNAME            = $00000012; // VT_LPSTR
  {$EXTERNALSYM PIDSI_DOC_SECURITY}
  PIDSI_DOC_SECURITY       = $00000013; // VT_I4
Daniel Lizbeth
Ich bin nicht zurück, ich tue nur so
  Mit Zitat antworten Zitat