> and the problem is that it is not working with the e.g. CD-ROM - i.e. is
> not retrieving details of the file (e.g. author, picture size, ...). I
[quoted text clipped - 4 lines]
> MSDN docs there is not written anything about such a limitation. Can
> anyone bring enlightenment for me and save my soul, please?
In order to retrieve metadata (e.g. author, picture size, ...) from a file,
you must obtain an IPropertySetStorage interface from the shell.
You use the shell method BindToStorage to get this interface.
> 2) If I use Shell32.Shell shell = new Shell32.ShellClass(); do I have to
> do any explicit releasing of the COM resources or so? I read somewhere in
> the inet (there are so many rumors in the inet) that I have to use
> releasecomobject or something like method to release resources. (can you
> provide link or explain lifecycle of this, please?)
There are two ways to work with COM in .Net. Managed or Unmanaged.
In Unmanaged COM, all the rules of COM apply. You are responsible for
reference counting and releasing intefaces when you no longer need them.
In Managed COM, a runtime callable wrapper is generated for the COM object.
The RCW is responsible for reference counting and managing the releasing of
the interfaces.
The online MSDN documentation explains all the details. The topics worth
reviewing include the rules of COM, RCW and System.Runtime.InteropServices.
Ondrej Psencik - 26 Apr 2007 13:35 GMT
Hi,
Unfortunately BindToStorage and enumerating properties is not doing what I
wanted, because It is retrieving only some properties
and not for example image properties (group Image) as they are seen if you
display file properties in explorer.
It is interesting that GetDetailsOf is working fine when retrieving
properties from hard drive, and from DVD it is
retieving nothing. But if you subst folder on DVD to e.g. Z: drive then
GetDetailsOf IS working on the file in this subst drive.
So there is something esoteric in GetDetailsOf .
Ondrej Psencik
>> and the problem is that it is not working with the e.g. CD-ROM - i.e. is
>> not retrieving details of the file (e.g. author, picture size, ...). I
[quoted text clipped - 28 lines]
> reviewing include the rules of COM, RCW and
> System.Runtime.InteropServices.