INTERACT FORUM

Windows => Plug-in Development => Topic started by: SteveC on April 10, 2007, 06:23:36 pm

Title: How to write a plug-in for MC12?
Post by: SteveC on April 10, 2007, 06:23:36 pm
I spent the evening writing some plugin stuff for a friend and ended up with working code, but being very confused by it all...  I think the wiki is rather mis-leading, or more likely, I'm working on one object while typing it as another.  Unfortunately, everyone's just put snippets of code rather than a whole example.

Anyway, main questions...

1/ What is the type of the object I get from CreateObject("MediaJukeBox Application") ?  I've been using it as an MCAutomation, but that appears to diverge from the SDK a lot, most annoyingly in the GetCurPlaylist automation area.

2/ If I'm controlling MediaCenter, should I be attaching to mediajukebox ?  I'm a bit confused by the object naming here!

Help appreciated :)  I'd update the wiki with my findings, but they're so confused that it would be even more disorientating!
Title: Re: How to write a plug-in for MC12?
Post by: KingSparta on April 10, 2007, 07:10:44 pm
it is old documentation

the updated doc for media center vanished when they put all that on wiki

your not the only one Dazed and Confused...
Title: Re: How to write a plug-in for MC12?
Post by: SteveC on April 11, 2007, 02:22:43 am
Hmm, some of my problems were actually my usual Sub Vs. function Vs. () vs. not in VB (I hate VB6), however, some of the docs are still a bit wrong..

My current object creation code is (incidentally, all examples could do with being replaced with this, on error resume next is 'orrible):

Quote

Private WithEvents MC As MCAutomation

Private Function ErrFunction() As Integer
    Select Case Err.Number
        Case 462
            Set MC = CreateObject("MediaJukebox Application")
            ErrFunction = 1
        Case 429
            Set MC = CreateObject("MediaJukebox Application")
            ErrFunction = 1
        Case Else
            MsgBox (Err.Description)
            ErrFunction = 0
    End Select
End Function

Private Sub Form_Load()
    On Error GoTo ErrHandler
   
    Set MC = GetObject(, "MediaJukebox Application")
   
    szCurrentScheme = ""
    intCurrentPlaylist = 0
    txtScheme.Text = MC.GetViewScheme(szCurrentScheme).GetScheme(0).GetName()
   
Exit Sub
ErrHandler:
    If ErrFunction Then
        Resume Next
    Else
        End
    End If
End Sub


The docs (paraphrasing) prototype as follows
Quote
void MJFilesAutomation.Play()

it is actually:

Quote
void MJFilesAutomation.Play(number Position)

I guess the current docs are just inaccurate in places...?