Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   Delphi GetActiveOleObject('WMPlayer.OCX') funktioniert nicht :( (https://www.delphipraxis.net/77078-getactiveoleobject-wmplayer-ocx-funktioniert-nicht.html)

endeffects 14. Sep 2006 13:05


GetActiveOleObject('WMPlayer.OCX') funktioniert nicht :(
 
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;

mkinzler 14. Sep 2006 14:03

Re: GetActiveOleObject('WMPlayer.OCX') funktioniert nicht :(
 
hast dus mal über die GUID versucht?

endeffects 14. Sep 2006 14:07

Re: GetActiveOleObject('WMPlayer.OCX') funktioniert nicht :(
 
ich weiß nicht wie das funktioniert =(

shmia 14. Sep 2006 14:08

Re: GetActiveOleObject('WMPlayer.OCX') funktioniert nicht :(
 
Die Exception wird doch nur in der Delphi IDE angezeigt.
Danach kannst du doch mit F9 das Programm fortsetzen.
http://www.delphipraxis.net/internal...ct.php?t=47972


Alle Zeitangaben in WEZ +1. Es ist jetzt 20:42 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz