-1
  • 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?

Alex Shul
  • 500
  • 7
  • 22
  • Why did you choose to embed Mozilla's plugin? I've successfully embedded both Flash and Shockwave into my apps using the IE's ActiveX plugin. Unlike NPP, ActiveX technology is mature, stable, and the SDK is exceptionally good: you can embed an ActiveX with just a few lines of code in ATL, and there are great tools in the SDK, such as ActiveX text container and OleView. – Soonts Feb 12 '14 at 19:42
  • @Soonts, can i correctly open objects on web pages with mime type "application/x-shockwave-flash" with ActiveX plugin & ATL ? – Alex Shul Feb 12 '14 at 19:54
  • What do you mean "on web pages"? If you have a web page opened, it means you already have a web browser, and you do not need to embed a flash plugin in your code. If you are going to steal SWFs from other people’s pages, be warned that is illegal. Besides, the developer of those SWF can take measures against doing that, regardless of which version of the flash you’ll use, NPAPI or ActiveX. – Soonts Feb 12 '14 at 20:00
  • I just trying to open some browser games for making AI, which will do some repetitive actions instead of player. It's very interesting for me to do that tool. – Alex Shul Feb 12 '14 at 20:09

1 Answers1

1

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..

Soonts
  • 20,079
  • 9
  • 57
  • 130
  • Not working: `CShockwaveFlash m_FlashPlayer` `void CFlashDisplayerDlg::OnClickedButtonPlay() { MessageBoxA(NULL, "Clicked!", "BOOM!", MB_OK); m_FlashPlayer.put_Movie(L"mammyblue2.swf"); m_FlashPlayer.Play(); }` Message Box executed, movie - not. – Alex Shul Feb 12 '14 at 21:52
  • Replace `put_Movie(L"mammyblue2.swf")` with `LoadMovie(0, L"C:\\Temp\\mammyblue2.swf")` – Soonts Feb 12 '14 at 23:09
  • It's worked! Where i can find `CShockwaveFlash` overview? – Alex Shul Feb 13 '14 at 04:35
  • How can i get data, from ActiveX requests? How can i monitoring this requests? – Alex Shul Feb 13 '14 at 06:19
  • I don't know, but you probably should ask another question[s] on SO. – Soonts Feb 13 '14 at 13:15