Page 3 of 4
Posted: Tue Jul 08, 2008 3:49 pm
by Softanics
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.
Posted: Tue Jul 08, 2008 4:17 pm
by tmillhouse@gmail.com
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
Posted: Tue Jul 08, 2008 4:24 pm
by Softanics
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.
Posted: Tue Jul 08, 2008 4:56 pm
by tmillhouse@gmail.com
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
Posted: Tue Jul 08, 2008 5:09 pm
by Softanics
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.
Posted: Wed Jul 09, 2008 3:41 pm
by tmillhouse@gmail.com
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
Posted: Wed Jul 09, 2008 4:22 pm
by Softanics
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.
Posted: Wed Jul 09, 2008 5:04 pm
by tmillhouse@gmail.com
hmm ... well now it doesn't equal S_OK. How would I go about printing the value of FPCCallFunctionBSTR.
Thanks,
Tim
Posted: Wed Jul 09, 2008 5:08 pm
by tmillhouse@gmail.com
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
Posted: Wed Jul 09, 2008 5:12 pm
by Softanics
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);
Posted: Wed Jul 09, 2008 5:14 pm
by Softanics
tmillhouse@gmail.com wrote:actually, I just put an '&' in front of hwndFlashPlayerControl
Code: Select all
FPCCallFunctionBSTR(&m_hwndFlashPlayerControl,
?
Posted: Wed Jul 09, 2008 5:16 pm
by tmillhouse@gmail.com
With that call, I'm getting
Error E2227 hook-wininet.c 76: Extra parameter in call to OutputDebugStringW in function HookInternetConnectW
Thanks,
Tim
Posted: Wed Jul 09, 2008 5:16 pm
by tmillhouse@gmail.com
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);
Posted: Wed Jul 09, 2008 5:41 pm
by Softanics
You should use:
FPCCallFunctionBSTR(hwndFlashPlayerControl
without & .
What does it return if you don't use & ?
Posted: Wed Jul 09, 2008 5:44 pm
by tmillhouse@gmail.com
What is the return type of FPCCallFunctionBSTR? I'll need to convert it to something I can print.
Thanks,
Tim