This post will disappear in a short time due to poor ISP service by Verio so
I hope it gets archived to help others.
Problem: A dll allows me to run other windows programs from Dolphin. I'm
attempting to make a simple webcam by defining three methods, one to grab a
video frame, one to store it, and on to upload it via an FTP program. These
methods work well when executed one at a time but fail when executed all at
once or in a loop, often confusing the contexts.
Kirk W. Fraser
Solutions thanks to Ian Bartholomew and Andy Bower:
[Ian evaluates code & suggests]
ints are signed 32 bit values so I think they should all use "sdword"
getAppTitle: appInt
"char* GetAppTitle( int index );
returns pointer to a null terminated string containing the
title bar text of application[index] ."
<stdcall: lpstr GetAppTitle sdword>
^self invalidCall
[This suggestion is tried but problem remains.]
About the only thing left is looking into the whether the dll needs separate
threads working at the same time as the main Dolphin thread, not really
something I can tell from a distance.
Ian
[Andy's response]
I imagine what is probably happening is that your DLL is making calls to
other programs which eventually end up in sending Windows (WM_XXX) messages
back to Dolphin. In order for Dolphin to process incoming messages the main
polling event process must be runnning, however, during an external call the
Dolphin VM main execution thread is normally suspended waiting for the DLL
to return. This means that *all* Dolphin processes (including the UI
process) are blocked waiting for the DLL function to complete. If you
execute your statements one at a time then after each one the UI process
gains control again and things can sort things out. If you execute them all
at once then things may lock up or get confused.
What you can try is to make the problem external call "overlapped". This
means that Dolphin starts another native thread to execute the external call
and then only the calling Smalltalk process is blocked (not the VM execution
thread) and this doesn't then hold up the Dolphin event loop. Normally,
you'll have to start another Smalltalk process to execute your DLL calls too
unless you are making the calls from a workspace (which automatically starts
a new UI process if the real one is held up for any length of time).
Anyway, take a look at the Education Centre to find out how to make an
external call, "overlapped":
http://www.object-arts.com/Lib/EducationCentre4/htm/overlappedcalls.htmBTW, this sort of query should really be posted to the Dolphin newsgroup so
that everyone can get the benefit of the solution (by looking in the
archives etc).
Best Regards,
Andy Bower
Dolphin Support
http://www.object-arts.com---
Are you trying too hard?
http://www.object-arts.com/Relax.htm---