🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #13712

Re: File properties

#13712
From: Remy Lebeau (TeamB)
Date: Fri, 19 Sep 2003 06:23
53 lines
2541 bytes
--- "Ambiel.Terry" <Terry.Ambiel@IGT.com> wrote:
> I am trying to access Author specifically.

There is no way you can access that particular property without opening the
file.  What you're asking for requires you to obtain the file's Summary
Information, as per the following articles:

    Structured Storage Serialized Property Set Format

http://msdn.microsoft.com/library/en-us/stg/stg/structured_storage_serialized_property_set_format.asp

    Properties and Property Sets

http://msdn.microsoft.com/library/en-us/stg/stg/properties_and_property_sets.asp

    The Summary Information Property Set

http://msdn.microsoft.com/library/en-us/stg/stg/the_summary_information_property_set.asp


For example (untested, and this only works under Windows 2K and XP):

    #include <objbase.h>
    #include <utilcls.h>

    TComInterface<IPropertySetStorage> pss;

    HRESULT hRes = StgOpenStorageEx(WideString("c:\\somefile.ext"),
STGM_READ, STGFMT_FILE, 0, NULL, NULL, IID_IPropertySetStorage,
(LPVOID*)&pss);
    if( SUCCEEDED(hRes) )
    {
        TComInterface<IPropertyStorage> ps;

        hRes = pss->Open(FMTID_SummaryInformation, STGM_READ, &ps);
        if( SUCCEEDED(hRes) )
        {
            PROPSPEC rgspec = {PRSPEC_PROPID, PIDSI_AUTHOR};
            PROPVARIANT rgvar;

            hRes = ps->ReadMultiple(1, &rgspec, &rgvar);
            if( SUCCEEDED(hRes) )
            {
                // rgvar.pszVal contains the author, use as needed
                ShowMessage(rgvar.pszVal);
                PropVariantClear(&rgvar);
            }
        }
    }


Gambit
Technical Details
Message-ID: <3f6aa094$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail
References: <3f6a35c7$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,b3ca159ecc7cdcf0
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-09-18 23:26:35 PST
From: "Remy Lebeau \(TeamB\)" <gambit47@yahoo.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3f6a35c7$1@newsgroups.borland.com>
Subject: Re: File properties
Date: Thu, 18 Sep 2003 23:23:12 -0700
Lines: 55
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 207.175.226.26
Message-ID: <3f6aa094$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1063952532 207.175.226.26 (18 Sep 2003 23:22:12 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail