loading .swf into dll

DLL Edition of the F-IN-BOX
Softanics
Site Admin
Posts: 1402
Joined: Sat Sep 18, 2004 3:03 am
Location: Russia, St. Petersburg
Contact:

Postby Softanics » Tue Jul 08, 2008 3:49 pm

tmillhouse@gmail.com wrote:Is there a good example somewhere loading a SWF file?


Load it as you tried before. If a movie comes from URL, one should use FPC_LoadMovie.
Best regards, Artem A. Razin,
F-IN-BOX support
Ask your question here: http://www.f-in-box.com/support.html

tmillhouse@gmail.com
Posts: 29
Joined: Wed Jul 02, 2008 5:54 pm

Postby tmillhouse@gmail.com » Tue Jul 08, 2008 4:17 pm

So load it using using FPC_LoadMovie from within a different Thread?

For the past couple of hours I've been working toward reproducing example 8 (streams). Currently I'm trying to get it to compile using Borland compiler.

Thanks,
Tim

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

Postby Softanics » Tue Jul 08, 2008 4:24 pm

tmillhouse@gmail.com wrote:So load it using using FPC_LoadMovie from within a different Thread?


Yes. Create a f-in-box window and load a movie within this separate thread. Don't forget to include GetMessage / DispatchMessage standard cycle.

Thank you.
Best regards, Artem A. Razin,

F-IN-BOX support

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

tmillhouse@gmail.com
Posts: 29
Joined: Wed Jul 02, 2008 5:54 pm

Postby tmillhouse@gmail.com » Tue Jul 08, 2008 4:56 pm

pardon my ignorance, but what exactly is the GetMessage/Dispatch message cycle? I did a search through the example code projects and only saw a couple instances of 'DispatchMessage'. I'll look only to find its relevance, but I would appreciate your opinion no the matter.

Thanks again,
Tim

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

Postby Softanics » Tue Jul 08, 2008 5:09 pm

Your thread should look like the following:

Code: Select all

FPC_LoadRegisteredOCX(...);

FPC_CreateWindow(...);

FPC_LoadMovie(...);

// The message cycle; flash needs it
MSG msg;
BOOL bRet;
while( (bRet = GetMessage( &msg, NULL, 0, 0 )) != 0)
{
   TranslateMessage(&msg);
   DispatchMessage(&msg);
}


Thank you.
Best regards, Artem A. Razin,

F-IN-BOX support

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

tmillhouse@gmail.com
Posts: 29
Joined: Wed Jul 02, 2008 5:54 pm

Postby tmillhouse@gmail.com » Wed Jul 09, 2008 3:41 pm

Great! Using your template, I was able to load my SWF file successfully. So, now I have started a new thread that loads the SWF file; however, I'm still not able to successfully invoke a SWF method using the external interface. I'm currently testing using the externalinterface.swf that came in the sample code, and I'm calling it as the sample code does. Is there a special way to invoke the FPCCallFunctionBSTR since it is running in its own thread?

Again, thanks for all your help.

Thanks,
Tim

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

Postby Softanics » Wed Jul 09, 2008 4:22 pm

tmillhouse@gmail.com wrote:I'm currently testing using the externalinterface.swf that came in the sample code, and I'm calling it as the sample code does.


OK, please try:

Code: Select all

   BSTR bstrRequest = SysAllocString(L"<invoke name="CallMeFromApplication" returntype="xml"><arguments><string>Some text for FlashPlayerControl</string></arguments></invoke>");
   BSTR bstrResponse;

   if (S_OK ==
      FPCCallFunctionBSTR(m_hwndFlashPlayerControl,
                       bstrRequest,
                     &bstrResponse))
   {
...
   }


What bstrResponse contains after the call?

Thank you.
Best regards, Artem A. Razin,

F-IN-BOX support

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

tmillhouse@gmail.com
Posts: 29
Joined: Wed Jul 02, 2008 5:54 pm

Postby tmillhouse@gmail.com » Wed Jul 09, 2008 5:04 pm

hmm ... well now it doesn't equal S_OK. How would I go about printing the value of FPCCallFunctionBSTR.

Thanks,
Tim

tmillhouse@gmail.com
Posts: 29
Joined: Wed Jul 02, 2008 5:54 pm

Postby tmillhouse@gmail.com » Wed Jul 09, 2008 5:08 pm

actually, I just put an '&' in front of hwndFlashPlayerControl and it now equals S_OK. Now let me figure out how to convert BSTR into something I can output to windows debugger. I can't use the <atlconv.h> b/c its not included w/ my compiler

Thanks,
Tim

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

Postby Softanics » Wed Jul 09, 2008 5:12 pm

tmillhouse@gmail.com wrote:actually, I just put an '&' in front of hwndFlashPlayerControl and it now equals S_OK. Now let me figure out how to convert BSTR into something I can output to windows debugger. I can't use the <atlconv.h> b/c its not included w/ my compiler


Please try:

Code: Select all

OutputDebugStringW(L"%s\n", bstrResponse);
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 » Wed Jul 09, 2008 5:14 pm

tmillhouse@gmail.com wrote:actually, I just put an '&' in front of hwndFlashPlayerControl


Code: Select all

FPCCallFunctionBSTR(&m_hwndFlashPlayerControl,


?
Best regards, Artem A. Razin,

F-IN-BOX support

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

tmillhouse@gmail.com
Posts: 29
Joined: Wed Jul 02, 2008 5:54 pm

Postby tmillhouse@gmail.com » Wed Jul 09, 2008 5:16 pm

With that call, I'm getting

Error E2227 hook-wininet.c 76: Extra parameter in call to OutputDebugStringW in function HookInternetConnectW


Thanks,
Tim

tmillhouse@gmail.com
Posts: 29
Joined: Wed Jul 02, 2008 5:54 pm

Postby tmillhouse@gmail.com » Wed Jul 09, 2008 5:16 pm

My code now looks like this

if (S_OK ==
FPCCallFunctionBSTR(&hwndFlashPlayerControl,
bstrRequest,
&bstrResponse))
{
OutputDebugString(_TEXT("S_OK"));
OutputDebugStringW(L"%s\n", bstrResponse);

SysFreeString(bstrResponse);
}else{
OutputDebugString(_TEXT("NOT OK"));
}
SysFreeString(bstrRequest);

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

Postby Softanics » Wed Jul 09, 2008 5:41 pm

You should use:

FPCCallFunctionBSTR(hwndFlashPlayerControl

without & .

What does it return if you don't use & ?
Best regards, Artem A. Razin,

F-IN-BOX support

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

tmillhouse@gmail.com
Posts: 29
Joined: Wed Jul 02, 2008 5:54 pm

Postby tmillhouse@gmail.com » Wed Jul 09, 2008 5:44 pm

What is the return type of FPCCallFunctionBSTR? I'll need to convert it to something I can print.

Thanks,
Tim


Return to “DLL Edition”

Who is online

Users browsing this forum: No registered users and 19 guests

cron