COM events

Download and get help for different MediaMonkey for Windows 4 Addons.

Moderators: Peke, Gurus

Humpty
Posts: 40
Joined: Wed Aug 18, 2004 1:04 am

COM events

Post by Humpty »

How do I handle an event raised by a COM object? I made a dll in VB that raises an event but I don't know how to handle it in MM. I'm using 2.3.1.834.
jiri
Posts: 5419
Joined: Tue Aug 14, 2001 7:00 pm
Location: Czech Republic
Contact:

Post by jiri »

First of all, there are two types of events implemented in MM - one special type that is needed for scripting, because vbs or js scripts cannot implement standard COM events. The second event are standard COM events (that's what are you talking about). These are implemented in a standard way in MM, i.e. you can use them as from any other COM object. I don't know exactly VB specifics about this, but you can definitely find examples by Google. Let us know should you have any further problem with this...

Jiri
Humpty
Posts: 40
Joined: Wed Aug 18, 2004 1:04 am

Post by Humpty »

I was looking around myself and kept coming up with ASP examples, something like:

<script type="VBScript">
sub ObjectName_ObjectEvent
end sub
</script>

I tried the naming convention listed above but it didn't work, I'll try the <script> tags method and let you know.
Humpty
Posts: 40
Joined: Wed Aug 18, 2004 1:04 am

Post by Humpty »

The <script> tags didn't work, got a parse error like I expected.

So far everything I've been reading points to the host application, MM in this case, providing some interface to an object's events. For example, Windows Script Host (WSH) provides the CreateObject method which has a parameter that lets you specify a prefix and WSH will use that and the event name to determine a procedure in your script to call, e.g. ObjectName_EventName. IE uses the script tags method I mentioned earlier. VB has the WithEvents keyword that's used when an object is declared, for example Dim WithEvents object as Someobject, and then later on it calls a procedure of the form ObjectName_EventName. Some script hosts, like ASP, simply don't provide any way of handling COM events.

Since handling events is different in every script host can you list any examples of handling events via script in MM?
Post Reply