Board index » cppbuilder » how to read file properties such as Title, Author, Subject, etc.?

how to read file properties such as Title, Author, Subject, etc.?


2006-05-13 06:56:01 PM
cppbuilder56
Hello, everybody!
Does anybody know a simple way to programmatically get a file properties
such as
Title, Author, Subject, Keywords, Comments, etc.? (These property values are
displayed
by the user when he/she selects a file in Explorer then chooses the
Properties menu item.)
I need to read those properties for excel files without Excel installed.
Thank you very much.
Edward.
 
 

Re:how to read file properties such as Title, Author, Subject, etc.?

13 May 2006 14:56:01 Edward wrote:
Quote
Does anybody know a simple way to programmatically get a file properties such as
Title, Author, Subject, Keywords, Comments, etc.? (These property values are displayed
by the user when he/she selects a file in Explorer then chooses the Properties menu item.)
The good portion is I have the right answer:
IShellFolder2::GetDetailsEx
msdn.microsoft.com/library/default.asp
The sad portion is I didn't make it work.
If you do, can you upload a copy in attachment section ?
Thnks.
 

Re:how to read file properties such as Title, Author, Subject, etc.?

Hello, John,
There is another way to do the job - to use IPropertySetStorage and
IPropertyStorage interfaces.
Hope this should work.
"John" <john@antispam>wrote in message
Quote
13 May 2006 14:56:01 Edward wrote:

>Does anybody know a simple way to programmatically get a file properties
>such as
>Title, Author, Subject, Keywords, Comments, etc.? (These property values
>are displayed
>by the user when he/she selects a file in Explorer then chooses the
>Properties menu item.)

The good portion is I have the right answer:
IShellFolder2::GetDetailsEx

msdn.microsoft.com/library/default.asp

The sad portion is I didn't make it work.

If you do, can you upload a copy in attachment section ?

Thnks.
 

{smallsort}

Re:how to read file properties such as Title, Author, Subject, etc.?

Hello, Edward,
Quote
There is another way to do the job - to use IPropertySetStorage and IPropertyStorage interfaces.
Hope this should work.
I came to understand that these interfaces can obtain title, author, subject, etc
as long as referred objects are structured and compound files.
I say so because I couldn't open with StgOpenStorageEx on a flat file.
Thnks for the suggestion anyway.
 

Re:how to read file properties such as Title, Author, Subject, etc.?

"John" <john@antispam>wrote in message
Quote
I came to understand that these interfaces can obtain title, author,
subject, etc as long as referred objects are structured and compound
files.
That is not entirely correct. See below.
Quote
I say so because I couldn't open with StgOpenStorageEx on a flat file.
Then you likely are not specifying the correct parameters to the function.
Please show your actual code. You must specify STGFMT_FILE or STGFMT_ANY
for the stgfmt parameter, and IID_IPropertySetStorage for the riid
parameter, when calling StgOpenStorageEx() on a non-compund file.
On an NTFS-based system, the OS provides an implementation of the
IPropertySetStorage interface for files that are not compound files, so that
summary information can still be read/written for such files, and the
underlying file system stores the property set in a separate stream from the
actual file data.
Refer to the following articles for more details:
IPropertySetStorage-NTFS File System Implementation
msdn.microsoft.com/library/en-us/stg/stg/ipropertysetstorage_ntfs_file_system_implementation.asp
STGFMT
msdn.microsoft.com/library/en-us/stg/stg/stgfmt.asp
The Summary Information Property Set
msdn.microsoft.com/library/en-us/stg/stg/the_summary_information_property_set.asp
Predefined Property Set Format Identifiers
msdn.microsoft.com/library/en-us/stg/stg/predefined_property_set_format_identifiers.asp
The DocumentSummaryInformation and UserDefined Property Sets
msdn.microsoft.com/library/en-us/stg/stg/the_documentsummaryinformation_and_userdefined_property_sets.asp
Gambit
 

Re:how to read file properties such as Title, Author, Subject, etc.?

Quote
On an NTFS-based system, the OS provides an implementation of the
IPropertySetStorage interface for files that are not compound files, so that
My mistake was to open on StgOpenStorageEx with IID_IStorage
then QueryInterface on IID_IPropertySetStorage.
If I open on IID_IPropertySetStorage. Bingo.
Thank you both Remy and Edward.