Exception for FPCCallFunctionBSTR

DLL Edition of the F-IN-BOX
theomania
Posts: 12
Joined: Thu Nov 03, 2005 4:31 pm

Exception for FPCCallFunctionBSTR

Postby theomania » Tue Oct 10, 2006 12:20 am

Hi,

Every so often in a project im working on when calling ExternalInterface (specificallym FPCCallFunctionBSTR), i receive an exception. i wrapped some __try __except around the function, and know this is where it is occuring. It also only seems to ever happen (and only rarely at that), when calling via a thread (even though 99 times out of 100 it works fine).
If i catch this exception, subsequest calls will always "Fail" (not cause an exception)

My question is:
* Has anyone else ever received this problem? Explanation/solution?
* Could passing "junk" data to this function cause this problem?
* Could the threading issue cause this problem? I.e. if more than once "FPCCallFunctionBSTR" is called at any given time via threads?

I am still investigating, and suspect it is the latter, but any information would be fantastic.

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

Postby Softanics » Tue Oct 10, 2006 4:25 am

Thank you for your question.

Serialize your calls. For example, you can create a message and handle it in the window procedure of parent window. In the handler call FPCCallFunctionBSTR, parameters are unpacked from lParam / wParam.
Best regards, Artem A. Razin,
F-IN-BOX support
Ask your question here: http://www.f-in-box.com/support.html

theomania
Posts: 12
Joined: Thu Nov 03, 2005 4:31 pm

Thanks

Postby theomania » Fri Oct 27, 2006 4:13 am

Thanks for your suggestion. I ended up using a Mutex to ensure that access to any operation that calls FPC must have exclusive access. I hope this will address the issue, it makes sense really.

I'll let you know.

Incidentally, this ended up being an extremely frustrating thing to solve, mainly because its difficult to reproduce on my machine, but some friends had it occur more regularly. Maybe some information / examples for other users in the documentation could be useful, as i am sure im not the only person using multiple threads, movies, and access. Or, alternativelty, add such functionality (mutex, etc.) to the control itself. Just some ideas.

Cheers,

T.

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

Re: Thanks

Postby Softanics » Fri Oct 27, 2006 7:08 am

theomania wrote:Or, alternativelty, add such functionality (mutex, etc.) to the control itself. Just some ideas.


Yes, that's good idea.

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