HydrogenAudio

Hosted Forums => foobar2000 => Development - (fb2k) => Topic started by: Hero.Hua on 2003-06-03 15:53:38

Title: About Components
Post by: Hero.Hua on 2003-06-03 15:53:38
Want to active another plugin, but dont know how to do
Someone do me a favor to tell me ?

How to use these:

virtual service_base * service_enum_create(const GUID &g,int n)=0;
virtual int service_enum_get_count(const GUID &g)=0;

and another one in service.h

static service_base * enum_create(const GUID &g,int n);
Title: About Components
Post by: Curi0us_George on 2003-06-03 18:26:00
There are some examples in the SDK of how to use the enumerations. (Or so Peter says.  I haven't actually looked.)

Basically, there is no way to enumerate the plugins, because there is no "plugin" base class.  You can enumerate the context menu items or the components menu items, though.
Title: About Components
Post by: foosion on 2003-06-03 21:40:07
You don't need to call those functions directly. If you would like to enumerate implementations for some foo service, you can use code like this:
Code: [Select]
    service_enum_t<foo> e;
    foo * ptr;
    for(ptr=e.first();ptr;ptr=e.next())
    {
 /* do something with ptr here */
 ptr->service_release();
    }

Of course you can also store the values returned by e.first(), and release them later. You also don't need to iterate until e.first() returns 0.
Title: About Components
Post by: Hero.Hua on 2003-06-04 01:50:44
thx!