Einzelnen Beitrag anzeigen

endeffects

Registriert seit: 27. Jun 2004
450 Beiträge
 
#1

GetActiveOleObject('WMPlayer.OCX') funktioniert nicht :(

  Alt 14. Sep 2006, 13:05
Hallo,

ich möchte mit foglendem SourceCode in mehreren Threads
die Titel-, Interpreten- und Albennamen von diversen
wma Dateien auslesen. Leider bleibt der Compiler hier hängen:

wmplayer := GetActiveOleObject('WMPlayer.OCX');

Mit der Meldung dass das Objekt nicht gefunden worden ist.
Weiß Jemand wie ich das beheben kann?

Delphi-Quellcode:
type
  TWMAFileInfo = record
    Duration: string;
    Author: string;
    CurrentBitRate: string;
    FileSize: string;
    Is_Protected: Boolean;
    SourceURL: string;
    Title: string;
    Album: string;
    Composer: string;
    Genre: string;
    Lyrics: string;
    TrackNumber: Integer;
    Year: Integer;
  end;

...

procedure TMyThreads.ReadWMATag(Filename: string; var TagInformation: TWMAFileInfo);
var
 wmplayer, wmfile: OLEVariant;
begin
 try
  try
   wmplayer := GetActiveOleObject('WMPlayer.OCX');
  except
   wmplayer := CreateOleObject('WMPlayer.OCX');
  end;
  wmfile := wmplayer.newMedia(Filename);

  TagInformation.Duration := wmfile.durationString;
  TagInformation.Author := wmfile.getItemInfo('Author');
  TagInformation.CurrentBitRate := wmfile.getItemInfo('CurrentBitRate');
  TagInformation.FileSize := wmfile.getItemInfo('FileSize');
  TagInformation.Is_Protected := wmfile.getItemInfo('Is_Protected');
  TagInformation.SourceURL := wmfile.getItemInfo('SourceURL');
  TagInformation.Title := wmfile.getItemInfo('Title');
  TagInformation.Album := wmfile.getItemInfo('WM/AlbumTitle');
  TagInformation.Composer := wmfile.getItemInfo('WM/Composer');
  TagInformation.Genre := wmfile.getItemInfo('WM/Genre');
  TagInformation.Lyrics := wmfile.getItemInfo('WM/Lyrics');
  TagInformation.TrackNumber := wmfile.getItemInfo('WM/TrackNumber');
  TagInformation.Year := wmfile.getItemInfo('WM/Year');
 finally
  wmfile := unassigned;
  wmplayer := unassigned;
 end;
end;
  Mit Zitat antworten Zitat