|
|
ActiveX-Exe blocking
I have an ActiveX-Exe that has a property "DoThis"
It looks like this
Public Property Let DoThis(byval uDo as boolean)
someform.Timer1.Enabled = uDo
End Property
The timer fires after 1 second, and I thought that my application would
return right after calling
myActiveXExe.DoThis = True
It looks like it does, but when the timer fires and calls the real sub,
my application is blocking as if it was waiting for the return of the
real call.
I am not sure why it does that...
The real call raises an event if a certain condition is true, and this
event is received by my app because I declared the ActiveX-Exe by using
WithEvents, but could that really be the cause why my app is blocking
during the call?
I thought by using a timer, my ActiveX-Exe was really async.
|
|
0
|
|
|
|
Reply
|
Boris
|
3/23/2010 6:57:38 PM |
|
On Tue, 23 Mar 2010 19:57:38 +0100, Boris Pauljev <nordiccoder@hotmail.com> wrote:
� I have an ActiveX-Exe that has a property "DoThis"
� It looks like this
�
� Public Property Let DoThis(byval uDo as boolean)
�
� someform.Timer1.Enabled = uDo
�
� End Property
�
� The timer fires after 1 second, and I thought that my application would
� return right after calling
�
� myActiveXExe.DoThis = True
�
� It looks like it does, but when the timer fires and calls the real sub,
� my application is blocking as if it was waiting for the return of the
� real call.
�
� I am not sure why it does that...
�
� The real call raises an event if a certain condition is true, and this
� event is received by my app because I declared the ActiveX-Exe by using
� WithEvents, but could that really be the cause why my app is blocking
� during the call?
� I thought by using a timer, my ActiveX-Exe was really async.
�
The code you are attempting to implement would require a client that runs out of process with
respect to the ActiveX EXE. There are other methods to simulate multi-threading in VB 6.0 and you
will find one example below:
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=24672&lngWId=-1
I'm sure Olaf Schmidt will probably chime in as well with his solutions.
Paul
~~~~
Microsoft MVP (Visual Basic)
|
|
0
|
|
|
|
Reply
|
Paul
|
3/23/2010 9:13:42 PM
|
|
No, I have the solution... My approach was really fine, the only problem
was the following:
I did this:
myactivexexe.DoThis
(after 1 second the timer is called, and the normally blocking call is
executed)
Now (while the ActiveXExe was still busy), I did the same again:
myactivexexe.DoThis
That was the problem and what caused the blocking in my real app.
The ActiveXExe was still busy executing the blocking call, and it could
immediatly return from the second DoThis because it was still busy
processing the blocking call.
The solution would be to either check if the blocking call is still
being executed in the the AX-exe or make a a second, "Overlord-"AX-Exe
which has knowledge about if the blocking call is still being executed
and which can discard the second "DoThis" in case it is.
|
|
0
|
|
|
|
Reply
|
Boris
|
3/24/2010 6:41:57 AM
|
|
"Boris Pauljev" <nordiccoder@hotmail.com> wrote
> I did this:
>
> myactivexexe.DoThis
>
> (after 1 second the timer is called, and the normally blocking call is
> executed)
>
> Now (while the ActiveXExe was still busy), I did the same again:
>
> myactivexexe.DoThis
>
> That was the problem and what caused the blocking in my real app.
That could be, but the scenareo you posted at first would also block
the AX from responding:
> The real call raises an event if a certain condition is true, and this
> event is received by my app because I declared the ActiveX-Exe by using
> WithEvents, but could that really be the cause why my app is blocking
> during the call?
When your AX raises an event, the routine where the event is raised will not
finish until all the listeners/subscribers/syncs (whatever) have responded
to the event.
So, if in your synced event you try to call back into the AX, that
call would be blocked because the AX is still executing the routine
where the event was raised. (It can only run one routine at a time)
While you may have nailed the problem with your double call
condition, as you stated, be watchful of this other condition as well....
LFS
|
|
0
|
|
|
|
Reply
|
Larry
|
3/24/2010 12:32:28 PM
|
|
|
3 Replies
336 Views
(page loaded in 0.078 seconds)
|
|
|
|
|
|
|
|
|