INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Beginner question  (Read 1973 times)

Polonio

  • Guest
Beginner question
« on: August 28, 2002, 11:42:15 am »

I just start looking yours MediaJukebox COM component.

But I has not able to create a MediaJukebox object. An error occurs.

Here is the VB code:

Private Sub Command1_Click()
   Dim mj As MediaJukebox.MJAutomation
   Set mj = New MediaJukebox.MJAutomation
End Sub

Can you send me a simple example for connecting to MJ?


Is it mandatory to run MJ meanwhile? How does it works?

Thanks in advance,

Polonio
Logged

Polonio

  • Guest
RE:Beginner question
« Reply #1 on: August 28, 2002, 11:54:56 am »

It is me again.

I read some more about Media Jukebox SDK, and I see that I must implement a function called Init(...) that Media Jukebox will call when starting the plugin to give me an object to control Media Jukebox with.

However, it seems to me that I need a DLL file in order to install de plug-in in MJ. But then, How can I debug my application?

Does exists any introductory document about this stuff? I do not find it. Any help welcomed.
Logged

Cephlen

  • Regular Member
  • Junior Woodchuck
  • **
  • Posts: 98
  • someday I will find a pic that looks good...
RE:Beginner question
« Reply #2 on: August 28, 2002, 12:08:29 pm »

Your plugin (assuming an interface plugin) is created as an ActiveX control (.ocx).

You have to modify the registry to let MJ know it exists (see the sample registry.reg file)

I usually create my plugins as an exe, and get as much working as possible.  Then I port it over to an ocx and finish it up with the MJ functions.

In order to use the MJ functionality, it has to be run inside the MJ.

Hope this helps!
-p
Logged
All ICQ's are ignored unless I have added you.

Polonio

  • Guest
RE:Beginner question
« Reply #3 on: August 28, 2002, 12:31:58 pm »

Thanks, Cephlen. Now at least I have a more clear idea. But I did not get it work yet.

Before anything else, I will try to make up the sample (BusyBoxCtrl).

I already add the registry entries (double clicking the reg file).

And then what?

I tried this:

-I add a new exe project.
-I establish the new project as a initial project.
-I add the BusyBoxCtrl in the form of the new project
-I restart Media Jukebox
-I run my new project

However, no one called the Init function, and an error occurs.

Public Function Init(ByVal MediaJukebox As Object)
   
   ' set the global Media Jukebox object on init
   ' (Media Jukebox will call this function when the plugin starts)
   Set g_MJ = MediaJukebox
   
End Function

How do I force MJ to call the Init function?
Logged

Cephlen

  • Regular Member
  • Junior Woodchuck
  • **
  • Posts: 98
  • someday I will find a pic that looks good...
RE:Beginner question
« Reply #4 on: August 28, 2002, 01:19:44 pm »

You cant run it inside an exe.  You have to run it inside the MJ.

So lets say you have an ocx that you are writing.

1. Use sample registry.reg to register the OCX so MJ knows it exists
2. Make the OCX and save it into the plugin directory
3. Run MJ, and in the left tree area, select your plugin.
Logged
All ICQ's are ignored unless I have added you.

Polonio

  • Guest
RE:Beginner question
« Reply #5 on: August 28, 2002, 03:34:17 pm »

Thanks, Cephlen. I did it.

Well, I just create the BusiBox.ocx, and get it working in MJ. It is a beginning :-)


However, this is not very useful for debugging. But well.. I'll try.



I usually create my plugins as an exe, and get as much working as possible.


Did yo mean that you create the interface (without accesing any MJ funcion) as an exe and, finally, add the MJ calls (as an ocx)?

I'll try.

Thanks a lot.
Logged

KingSparta

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 20063
RE:Beginner question
« Reply #6 on: August 28, 2002, 03:42:57 pm »

I think what he means is that when you develop a program you do not need to do hooks into mj.

filling up a list box, text box reading data etc... does not need the MJ interface. once some of the code is layed out then he starts working with the hooks in MJ to get it to work.

I made the same version of my program as an exe, and then ported it with the added MJ hooks.
Logged
Retired Military, Airborne, Air Assault, And Flight Wings.
Model Trains, Internet, Ham Radio, Music
https://MyAAGrapevines.com
https://centercitybbs.com
Fayetteville, NC, USA

Cephlen

  • Regular Member
  • Junior Woodchuck
  • **
  • Posts: 98
  • someday I will find a pic that looks good...
RE:Beginner question
« Reply #7 on: August 29, 2002, 08:47:14 am »

Yeah, let me try and list out my steps a bit better :)

1.  Create new .exe application
2.  Create all UI functionality, substituting MJ calls with variables.
3.  When you have dones AS MUCH as possible getting the UI to work, create a new OCX control
4.  Copy and paste all your form controls, then all your code from the EXE to the OCX.  Note that Me. has to be changed to UserControl. and your OnFormLoad becomes uhm... UserControl_Initialize.  Also note that on your Resize event, you have to check for scalewidth & scaleheight to not be 0.  For some reason, they are valued at 0 sometimes.
5.  Add MJ code.

When you recieve an error, the MJ will gray out your OCX.  Put in some debugging code to at least give you a quick message box with info in it, but if you get the EXE working good, there shouldnt be all that much trouble :)


----
here is a sample resize event block - check for 0's!!!:
If UserControl.ScaleWidth > 0 And UserControl.ScaleHeight > 0 Then
       Text1.Width = UserControl.ScaleWidth - 2300
       ProgressBar1.Top = UserControl.Height - ProgressBar1.Height
       ProgressBar1.Width = UserControl.Width - lblStatus.Width
       lblStatus.Left = UserControl.ScaleWidth - lblStatus.Width
       lblStatus.Top = UserControl.Height - ProgressBar1.Height
       WebBrowser1.Width = UserControl.Width
       WebBrowser1.Height = UserControl.Height - (Toolbar1.Height |PLS| ProgressBar1.Height)
End If

-----
another interesting thing... when poping up a new form, use vbModal:
Configure.Show vbModal, Me
Logged
All ICQ's are ignored unless I have added you.

Polonio

  • Guest
RE:Beginner question
« Reply #8 on: August 29, 2002, 03:10:47 pm »

Thanks Cephlen. I am already on the train :-)


However, I am coding in a different way. And it works me pretty well.

I work with a group of projects:

1.- Ocx project: The plug-in
1.- Exe project: A simple form with just one control: the ocx

This way I can build and debug the user interface directlly in the plug-in. And if I add some MJ calls, I just compile it and check it. I have to be aware of not use any MJ functionality from the VB form, but it is not so hard.

Well. Keep working.

By the way, I did not find the "ArtistAlbum" property. It is a wierd missing. don't?
Logged
Pages: [1]   Go Up