Can't use events when MM opened from external app

This forum is for reporting bugs in MediaMonkey for Windows 4. Note that version 4 is no longer actively maintained as it has been replaced by version 5.

Moderator: Gurus

darchangel
Posts: 26
Joined: Wed Nov 30, 2005 11:23 pm

Can't use events when MM opened from external app

Post by darchangel »

I'm desperately trying to find a way for a .NET windows application to do all of the following:
1) either the windows app launch MediaMonkey or have MediaMonkey automatically launch the windows app (ie: not have to manually call a script)
2) be able to call methods on the MediaMonkey API from the other app
3) subscribe to MM events

If I have MM autolaunch my app, then everything works fine as long as it's only a console app. If it's a winform app, then MM won't start until after the winform app is closed. While inconvenient, it seems to be logical behavior and hence, not a bug.

The following however does seem to be a bug (and is the only other way I can think of to fulfill the above requirements):
If I launch MediaMonkey with the winform app using

Code: Select all

SDBApplication SDB = new SDBApplicationClass();
then everything works except that I am unable to subscribe to events. Or rather: I can write the code to subscribe and when I run it no errors occur, but I never receive event notification from MM. I have written a few tiny test apps and these results are consistent across the board for my environment.

My environ: WinXP SP2. 2.66 gHz Penium 4. 1.5gb ram. 60gb primary partition. 1 cd-rw. 1 dvd rom. MediaMonkey v2.5.5.998 standard unregistered. No plugins. Only script = MagicNodes. Visual Studio 2005 Standard Ed. v8.0.50727.762

If you would like to see my code, I'd be glad to email it but it's far too much to post here.

Any help would be greatly appreciated.
M3lloware

Re: Can't use events when MM opened from external app

Post by M3lloware »

Bump....

This is still a bug except I get it from Delphi. i can do anything except receive events on the OnPlay same as this user is reporting from C# This bug was reported a year ago but still no Fix?

I have posted my example app here:

Code: Select all

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ComObj, SongsDB_TLB, OleServer, ExtCtrls;

type
  TForm1 = class(TForm)
    Memo1: TMemo;
    SDBApplication: TSDBApplication;
    Timer1: TTimer;
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure SDBApplicationChangedSelection(Sender: TObject);
    procedure SDBApplicationPlay(Sender: TObject);
    procedure SDBApplicationShutdown(Sender: TObject);
    procedure SDBApplicationPause(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
   SDBApplication.Connect;
   SDBApplication.ShutdownAfterDisconnect := True;
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
   // Free variable to avoid COM Warning
   FreeAndNil(SDBApplication);
end;

procedure TForm1.FormShow(Sender: TObject);
begin
   Sleep(1000);
end;

procedure TForm1.SDBApplicationChangedSelection(Sender: TObject);
begin
  MessageDlg('SDBApplicationChangedSelection', mtInformation, [mbOK], 0);
  Memo1.Lines.Add('Title: '+SDBApplication.Player.CurrentSong.Title);
  Memo1.Lines.Add('Artist: '+SDBApplication.Player.CurrentSong.ArtistName);
  Memo1.Lines.Add('Artist: '+SDBApplication.Player.CurrentSong.ArtistName);
end;

procedure TForm1.SDBApplicationPlay(Sender: TObject);
begin
  MessageDlg('SDBApplicationPlay', mtInformation, [mbOK], 0);
  Memo1.Lines.Add('Title: '+SDBApplication.Player.CurrentSong.Title);
  Memo1.Lines.Add('Artist: '+SDBApplication.Player.CurrentSong.ArtistName);
  Memo1.Lines.Add('Artist: '+SDBApplication.Player.CurrentSong.ArtistName);
end;

procedure TForm1.SDBApplicationShutdown(Sender: TObject);
begin
   MessageDlg('SDBApplicationShutdown', mtInformation, [mbOK], 0);
end;

procedure TForm1.SDBApplicationPause(Sender: TObject);
begin
   MessageDlg('SDBApplicationPause', mtInformation, [mbOK], 0);
end;
any update or word on this?

======================================
Melloware
http://www.melloware.com
Take Back control Of your PC!
======================================
Post Reply