INTERACT FORUM

Please login or register.

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

Author Topic: MJ9 Plugin Question  (Read 2131 times)

RhinoBanga

  • Citizen of the Universe
  • *****
  • Posts: 1703
  • Developer
MJ9 Plugin Question
« on: November 14, 2002, 12:12:52 am »

Hi Guys,

I have been looking at MJ9's plugin interface and I can't seem to get it to work.

I figured out that you moved the registry keys to HKEY_LOCAL_MACHINE so the plugin is now visible within MJ but in v8 the control's ::OnCreate is called prior to Init but in v9 I never get the ::OnCreate and as such I can't create any windows as I don't have a parent hWnd.


Any ideas?
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42372
  • Shoes gone again!
Re: MJ9 Plugin Question
« Reply #1 on: November 14, 2002, 04:18:22 am »

We'll look into it.  Hopefully within the next couple of builds it's be fixed.

Thanks for everything Rhino.
Logged
Matt Ashland, JRiver Media Center

RhinoBanga

  • Citizen of the Universe
  • *****
  • Posts: 1703
  • Developer
Re: MJ9 Plugin Question
« Reply #2 on: November 14, 2002, 04:25:12 am »

Thanks Matt ... I guess I'd better uninstall v9 until then :(
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42372
  • Shoes gone again!
Re: MJ9 Plugin Question
« Reply #3 on: November 20, 2002, 10:25:55 am »

From what I can tell, MJ isn't doing anything different.

Take a careful look at your messge map for your control.

The Sleep Timer looks like this:

BEGIN_MSG_MAP(CSleepTimerCtrl)
     CHAIN_MSG_MAP(CComCompositeControl<CSleepTimerCtrl>)
     COMMAND_HANDLER(IDC_SLEEP, BN_CLICKED, OnClickedSleep)
     MESSAGE_HANDLER(WM_TIMER, OnTimer)
     MESSAGE_HANDLER(WM_SIZE, OnSize)
END_MSG_MAP()

That CHAIN_MSG_MAP part steals the WM_INITDIALOG message, so it never makes it through.

Also, depending on the type of control, you may need to handle WM_INITDIALOG instead of WM_CREATE.

The easiest solution would be to call your OnCreate(...) code from Init(...) if it hasn't been run.  Use GetParent() if you need a parent.

Does that help at all?  Let me know what you figure out...
Logged
Matt Ashland, JRiver Media Center

RhinoBanga

  • Citizen of the Universe
  • *****
  • Posts: 1703
  • Developer
Re: MJ9 Plugin Question
« Reply #4 on: November 20, 2002, 12:19:54 pm »

Matt,

Here's my chain map:

BEGIN_MSG_MAP(CInterface)
     CHAIN_MSG_MAP(CComControl<CInterface>)
     DEFAULT_REFLECTION_HANDLER()
     MESSAGE_HANDLER(WM_SIZE, OnSize)
     MESSAGE_HANDLER(WM_CREATE, OnCreate)
     MESSAGE_HANDLER(WM_SETCURSOR, OnSetCursor)
     MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBkgnd)
END_MSG_MAP()



And I can definately state that OnCreate is called prior to Init as here is what I do:

LRESULT CInterface::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
   AFX_MANAGE_STATE( AfxGetStaticModuleState() );


   //  Store the hWnd
   AlbumView::m_hWnd = m_hWndCD;

     //  Are we on Windows XP?
     OSVERSIONINFO      vi;
     vi.dwOSVersionInfoSize = sizeof( vi );
     GetVersionEx( &vi );
     m_bIsXPOrGreater = ( vi.dwMajorVersion > 5  ||  (vi.dwMajorVersion == 5  &&  vi.dwMinorVersion >= 1) );

     m_hAppIcon = AfxGetApp()->LoadIcon( IDI_APP_ICON );

     // TODO : Add Code for message handler. Call DefWindowProc if necessary.
   return DefWindowProc( uMsg, wParam, lParam );
}



And in Init I use AlbumView::m_hWnd as the parent hWnd for all my top level controls.


I will download the latest version of v9 tomorrow and try it again but nothing has changed from my end so it must be something within MJ.


As a test do you have a version of sleep timer converted to work under MJ9?   Maybe we could use that to identify the issue?
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42372
  • Shoes gone again!
Re: MJ9 Plugin Question
« Reply #5 on: November 20, 2002, 12:29:10 pm »

Yeah, I played with Sleep Timer.  The version 8 one works.  So did one I rebuilt under VS.NET today.

And I did a side-by-side compare of the interface plugin creation code, and the only difference is the registry keys.  The only other thing I could imagine would be if somehow the MJFrame (the parent of the control) is in a different state during creation than it was in MJ 8.  Seems like a stretch though.

Let me know what you find...
Logged
Matt Ashland, JRiver Media Center

RhinoBanga

  • Citizen of the Universe
  • *****
  • Posts: 1703
  • Developer
Re: MJ9 Plugin Question
« Reply #6 on: November 20, 2002, 11:15:34 pm »

Matt,

There is definately an issue.

Using the MSDEV ATL COM wizard I created a DLL.   I then inserted an ATL object of type FullControl.   I then added the Init and Terminate methods then a handler for OnCreate.   Within each of these I placed a call to MessageBox.

In v8 I see OnCreate, Init and Terminate.

In v9 (both b77 and b80) I see Init and Terminate only.


I will send you the sample app in a separate email but it took me 2 minutes to create.



UPDATE


I'm at work and couldn't find your email address Matt so I sent it to matt@jriver.com ... hopefully it will get to you!
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42372
  • Shoes gone again!
Re: MJ9 Plugin Question
« Reply #7 on: November 21, 2002, 04:39:39 am »

You need to add this:

m_bWindowOnly = TRUE;

to the constructor of your CComControl.  Otherwise, make sure you pick "Windowed only" when using the wizard.

Don't ask why :P

Thanks Rhino.

-Matt
Logged
Matt Ashland, JRiver Media Center

RhinoBanga

  • Citizen of the Universe
  • *****
  • Posts: 1703
  • Developer
Re: MJ9 Plugin Question
« Reply #8 on: November 21, 2002, 05:06:20 am »

WOOHOO!!  ;D  ;D  ;D


A very strange one indeed.
Logged
Pages: [1]   Go Up