Multiple Use of ActiveX

DLL Edition of the F-IN-BOX
manjany
Posts: 5
Joined: Sat Jun 10, 2006 9:52 am
Location: FRANCE

Multiple Use of ActiveX

Postby manjany » Mon Oct 23, 2006 10:12 am

Hi there!
I have an MFC activeX which uses F-In-Box flash player.
My problem is when I try to instanciate 2 activeX

Code: Select all

<OBJECT id=FPlayer1 style="LEFT: 0px; WIDTH: 50%; POSITION: absolute; TOP: 0px; HEIGHT: 50%" classid="CLSID:12345678-9ABC-DEFG-HIJK-LMOPKRSTUVWX" VIEWASTEXT>
</OBJECT>

<OBJECT id=FPlayer2 style="LEFT: 0px; WIDTH: 50%; POSITION: absolute; TOP: 0px; HEIGHT: 50%" classid="CLSID:12345678-9ABC-DEFG-HIJK-LMOPKRSTUVWX" VIEWASTEXT>
</OBJECT>



In my Init function, i got failure for RegisterFlashWindowClass().
Due this failure I was enabled to load a flash movie for the second ActiveX.

Code: Select all

SHORT CMyFlashCtrl::Init(void)
{
   AFX_MANAGE_STATE(AfxGetStaticModuleState());


   if (!FPCIsFlashInstalled()) {
      AfxMessageBox(_T("The application needs Flash\nFlash is not installed"));
      return -1;
   }

   if (!RegisterFlashWindowClass()) {
      AfxMessageBox(_T("RegisterFlashWindowClass() failed"));
      return -1;
   }

   RECT rect;
   GetClientRect(&rect);
   m_hwndFlashPlayerControl= ::CreateWindow(   WC_FLASH, NULL ,  WS_CHILD | WS_VISIBLE, 
      rect.left,  rect.top,  rect.right - rect.left,  rect.bottom - rect.top,
      m_hWnd,  NULL,  NULL,  NULL );

   return 0;
}



Do you have any ideas to resolve this kind of problem ?
Thanks in advance.

Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Postby Softanics » Mon Oct 23, 2006 11:01 am

Thank you for your question.

The problem is related with global window classes that created by F-IN-BOX. The second call of RegisterFlashWindowClass fails if you didn't call UnregisterFlashWindowClass. The workaround for your case it to call RegisterFlashWindowClass on OCX loading and to call UnregisterFlashWindowClass on unloading. It should work well.

Also we are planning to include the ability to use any number of flash activex in the new release of F-IN-BOX. It solves problem with global window classes.

By the way, if you are planning to create ActiveX based on F-IN-BOX, you should obtain special license for that. Contact support http://f-in-box.com/support.html for more information.

Thank you.
Best regards, Artem A. Razin,
F-IN-BOX support
Ask your question here: http://www.f-in-box.com/support.html

manjany
Posts: 5
Joined: Sat Jun 10, 2006 9:52 am
Location: FRANCE

Postby manjany » Mon Oct 23, 2006 11:34 am

Thank you for your quick reply.

I already have UnregisterFlashWindowClass for the unloading.
But, when i create the second OCX, there is no Unloading for the first. That's why there is no call to UnregisterFlashWindowClass.

Anyway, don't worry about the license, my company have the license and the source code :P

Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Postby Softanics » Mon Oct 23, 2006 11:58 am

manjany wrote:I already have UnregisterFlashWindowClass for the unloading.
But, when i create the second OCX, there is no Unloading for the first. That's why there is no call to UnregisterFlashWindowClass.


So... did you solve the problem?
Best regards, Artem A. Razin,

F-IN-BOX support

Ask your question here: http://www.f-in-box.com/support.html

manjany
Posts: 5
Joined: Sat Jun 10, 2006 9:52 am
Location: FRANCE

Postby manjany » Mon Oct 23, 2006 1:33 pm

Unfortunatly, NO

As I said before, there is no call to UnregisterFlashWindowClass for the first ActiveX, that's the reason why for the second activeX RegisterFlashWindowClass always failed. And with this failure, Loading flash movie also failed.

Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Postby Softanics » Mon Oct 23, 2006 2:13 pm

You have two instances of one ActiveX. Am I right?

Call RegisterFlashWindowClass on the DLL loading (in MFC, in the overloaded InitInstance). When the DLL will loaded second time, InitInstance will not called. Call UnregisterFlashWindowClass in the overloaded ExitInstance.
Best regards, Artem A. Razin,

F-IN-BOX support

Ask your question here: http://www.f-in-box.com/support.html

Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Postby Softanics » Mon Oct 23, 2006 2:15 pm

manjany wrote:Anyway, don't worry about the license, my company have the license and the source code :P


:)
Read section "Usage" of the license http://f-in-box.com/dll/help/index/license.html
Best regards, Artem A. Razin,

F-IN-BOX support

Ask your question here: http://www.f-in-box.com/support.html

manjany
Posts: 5
Joined: Sat Jun 10, 2006 9:52 am
Location: FRANCE

Postby manjany » Mon Oct 23, 2006 5:11 pm

Softanics wrote::)
Read section "Usage" of the license http://f-in-box.com/dll/help/index/license.html


I don't know wich license my company bought. I should talk to my project manager.

But, what do you mean about the special License :oops: ? Price & Royalties ? Because, i wish to buy another license for my personal use.


I will test your tip later, I'll give you feedback these next days.

Thanks again.

Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Postby Softanics » Mon Oct 23, 2006 5:21 pm

manjany wrote:But, what do you mean about the special License :oops: ? Price & Royalties ? Because, i wish to buy another license for my personal use.


It depends on your project...
Please contact support with licensing questions: http://f-in-box.com/support.html

Thank you!
Best regards, Artem A. Razin,

F-IN-BOX support

Ask your question here: http://www.f-in-box.com/support.html

manjany
Posts: 5
Joined: Sat Jun 10, 2006 9:52 am
Location: FRANCE

Postby manjany » Mon Oct 30, 2006 11:30 am

Softanics wrote:You have two instances of one ActiveX. Am I right?

Call RegisterFlashWindowClass on the DLL loading (in MFC, in the overloaded InitInstance). When the DLL will loaded second time, InitInstance will not called. Call UnregisterFlashWindowClass in the overloaded ExitInstance.



Hi again,

First of all, sorry to give you a feedback only now

Well, I tried your method and It works only in one case. The case is if only if there is a tempo beetween the creation of these ActiveX. It's the same if i put a breakpoint (in my IDE ) . BUT i have the same result ( loading flash movie failure), if there isn't this tempo nor the breakpoint.

Maybe it's due the ressource problem or something like that. ???

Thanks

Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Postby Softanics » Mon Oct 30, 2006 11:53 am

manjany wrote:
Softanics wrote:Call RegisterFlashWindowClass on the DLL loading (in MFC, in the overloaded InitInstance). When the DLL will loaded second time, InitInstance will not called. Call UnregisterFlashWindowClass in the overloaded ExitInstance.

Well, I tried your method and It works only in one case. The case is if only if there is a tempo beetween the creation of these ActiveX. It's the same if i put a breakpoint (in my IDE ) . BUT i have the same result ( loading flash movie failure), if there isn't this tempo nor the breakpoint.


Let's check again.

1. The page is loading into IE.
2. The DLL is loaded. RegisterFlashWindowClass is called.
3. The first instance of the activex is created. CreateWindow returns non zero value (check it!).
4. You load a movie into first instance.
5. The second instance of the activex is created. CreateWindow returns non zero value (check it!).
6. You load a movie into second instance.
7. The page is unloading.
8. The DLL is unloaded. UnregisterFlashWindowClass is called.

The step 6 fails. Could you show me how you load a movie?
Best regards, Artem A. Razin,

F-IN-BOX support

Ask your question here: http://www.f-in-box.com/support.html


Return to “DLL Edition”

Who is online

Users browsing this forum: No registered users and 13 guests

cron