Reference is made to this post:
http://yabb.jriver.com/interact/index.php?topic=28732.0I've implemented the following code:
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using MediaJukebox;
namespace WindowsApplication1
{
public partial class fStart : Form
{
public fStart()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
MJAutomation aut = null;
aut = (MJAutomation)System.Runtime.InteropServices.Marshal.GetActiveObject("MediaJukebox Application");
MJPlaylistsAutomation playlists = aut.GetPlaylists();
for (int i = 0; i < playlists.GetNumberPlaylists(); i++)
{
MJPlaylistAutomation playlist = playlists.GetPlaylist(i);
listBox1.Items.Add(playlist.Name);
}
}
}
}
However, I'm receiving the following error message:
System.Runtime.InteropServices.COMException (0x800401E3): Operation unavailable. (Exception from HRESULT: 0x800401E3 (MK_E_UNAVAILABLE))
at System.Runtime.InteropServices.Marshal.GetActiveObject(Guid& rclsid, IntPtr reserved, Object& ppunk)
at System.Runtime.InteropServices.Marshal.GetActiveObject(String progID)
at WindowsApplication2.Form1.button1_Click(Object sender, EventArgs e) in C:\...
Anybody knows what I'm doing wrong??
Or, anybody has a working c# automation program???
Regards
Tom