function on that other thread. Most likely there's something you
are not doing that by happenstance was right on the COM thread.
Hi. Thanks to both for the suggestions.
The problem is more complicated. I'm using an API that returns event
through the registration of a callback function. Actually the time
consuming process (that calls API functions that generates callbacks to my
callback function) is inside a static function. If I call this function
directly from my method, everything works fine, apart that the method is
blocking and all the events are fired in batch at execution completed. Or,
better, are fired as they come, but the calling process is stuck, so it'll
receive all in batch at the end (the calling proc is an HTML, so
If I execute the same function as a separate thread:
_beginthread(StaticFunc, 0, this);
the method returns immediately, the function executes all its stuff
correctly (and access all class resources through the passed 'this'
pointer), but no event is generated (the callback function never gets
called). I don't need to generate my own events from the second thread,
but I need to manage the API generated events. I cannot use the methods
you suggest, simply because is the API that fires the events, not me.
"Alexander Nickolov" <firstname.lastname@example.org> ha scritto nel messaggio
See the folowing FAQ article for help with raising events fom
a worker thread back into an STA:
Microsoft MVP [VC], MCSD
MVP VC FAQ: http://vcfaq.mvps.org
<email@example.com> wrote in message
I developed an Activex object (to be used from HTML) with some methods.
The actual problem is that there's a method quite time consuming
(several minutes). When called, of course, the script (inside HTML)
waits until method completion. Any event fired in the meantime, is
queued and all fired upon method completion. Moreover the page is not
responsive. This is not what I intended to do. My goal is to call a
method that starts a process and returns immediately. Then the process
goes by itself, firing events that should be managed by the event
handler script in the HTML (including an event to say "I'm finished").
What's the best way to achieve this using only ATL (no MFC or extra
stuff cause my control is pure ATL, and I want to keep it so to reduce