INTERACT FORUM

Windows => Plug-in Development => Topic started by: salsbst1 on April 05, 2004, 08:51:47 am

Title: How to close/quit/shutdown an instance of MC started from MJAutomation?
Post by: salsbst1 on April 05, 2004, 08:51:47 am
How do I close/quit/shutdown an instance of MC that was started from MJAutomation (other than by killing the task)?  I guess in the days of "no access to the automation interface from out of process" this wasn't very important...
Title: Re:How to close/quit/shutdown an instance of MC started from MJAutomation?
Post by: RhinoBanga on April 06, 2004, 01:00:23 am
Which language?

If it's VB you have to set the MC instance to Nothing, e.g.:


Private Sub Command1_Click()
    On Error Resume Next

    Dim myMC As MediaJukebox.MJAutomation

    Set myMC = GetObject(, "MediaJukebox Application")
    If Err.Number = 429 Then
        Err.Clear
        Set myMC = CreateObject("MediaJukebox Application")
    End If

    If Err.Number Then
        MsgBox "Could not start MC - " & Err.Description
    Else
        '  Get rid of MC
        Set myMC = Nothing
    End If

End Sub



If it's C/C++ you have to make sure you release the COM object.

But I believe if you start up MC via COM then start it up manually then close your COM connection MC will still hang around.   Although don't hold me to that.
Title: Re:How to close/quit/shutdown an instance of MC started from MJAutomation?
Post by: salsbst1 on April 06, 2004, 07:24:14 am
Thanks for your response.  I just tested and it works fine in VB.

I'm actually using Java (not JavaScript).  There may be something wrong with the COM bridge (Jacob) or the wrapper that I generated (JacobGen) which is causing the COM reference count not to be decremented.