سؤال

  • I load Flash Player ( NPSWF32_12_0_0_44.dll )
  • Download html page and get < object > tag parameters:
    • id="flashcontent"
    • type="application/x-shockwave-flash"
    • data="http://foo/foo2.swf?123456"
    • width="800"
    • height="600"
  • Create Instance (with < object's > parameters).
  • Handle NPN_GetUserAgent (I use my app name as agent name) & NPN_GetValue calls (Give HWND and set private mode to false).

Question: Flash Player must call NPN_GetUrl or another method for requesting "http://foo/foo2.swf?123456" or i must do this by creating stream (when download resource)?

  • Anyway, i download this resource and call NPP_NewStream and then with NPP_WriteReady & NPP_Write give resource to plugin.
  • Handle NPN_GetUserAgent calls (again) and recieve 2 calls to NPN_GetUrl
    • First:
      • url: javascript:top.location+"__flashplugin_unique__"
      • window: NULL
    • Second:
      • url: javascript:window.location+"__flashplugin_unique__"
      • window: NULL

Question: What i must to do for handling this url requests? Why my window, which HWND i give to plugin, at this stage not painted by him?

Mozilla documentation says:

If the "window" is null, the browser creates a new stream and delivers the data to the current instance regardless of the MIME type of the URL

Question: What it means, when plugin requests javascript? How to make a dummy handler function for this?

هل كانت مفيدة؟

المحلول

I think it will be much easier for you to embed ActiveX instead of the Netscape plugin.

Here's a step by step guide how to embed a Flash movie into a dialog-based C++ MFC application.

That guide is for the old version of visual studio. In VS 2012, instead of the step "Project menu, select Add To Project sub-menu and then click Components and Controls" just open the dialog resource, right click on the dialog, "Insert ActiveX Control" then choose "Shockwave flash object". Then resume that guide from the step “Right-click on dialog and select "Class Wizard" to invoke Class Wizard”.

P.S. Begin with a simple SWFs from your HDD to debug your embedding code, only then experiment with your browser games..

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top