In Windows Explorer, extended file properties can be seen by showing extra columns.
I try to get this information programmatically, but have limited succes.
const
saHeader : array [0..7] of string = (
'File',
'Meewerkende artiesten',
'Album',
'Jaar',
'Auteurs',
'Titel',
'AlbumArtiest',
'Componisten'
);
var
Shell : Variant;
OleFolder : OleVariant;
OleFolderItem, OleDetail: OleVariant;
VsFilePath : Variant;
VsFileName : Variant;
PpPropNaam : TBSTR; //POleStr; //PWideChar;
begin
Shell := CreateOleObject('Shell.Application');
VsFilePath := Directory;
OleFolder := Shell.Namespace(VsFilePath);
VsFileName := ExtractFileName(FileName);
OleFolderItem := OleFolder.ParseName(VsFileName);
ExtProp := OleFolderItem.ExtendedProperty('Album'); //<---- results in correct value
ExtProp := OleFolderItem.ExtendedProperty('Meewerkende artiesten'); //<---- results in empty value (should be filled)
PpPropNaam := SysAllocString(Pointer(saHeader[2]));
ExtProp := OleFolderItem.ExtendedProperty(PpPropNaam); //<---- compiler: Type is not automatable: "PWideChar"
(I have W10 Dutch, Lazarus 2.0.6)
Using a fixed string without space, a correct value results.
Using a fixed string with a space, a blanc value results.
Using a variable TBSTR (as documented in MS documentation) results in a compiler-error.
What should I do to get correct values for
(1) fixed strings containing space(s)
(2) using variables representing strings?