I have a class module (ActiveX exe), which has a form with controls (most importantly a timer control). The Class Initialize method loads the form, and subsequently acts as an interface to the form. ie. When a class method is invoked by a client application, the class in turn calls a form routine to free up the calling client to do other things, while the ActiveX Exe performs other operations. This works very well, and enables concurrency between programs.
Public Sub ExecuteDoSomething()
'--------------------------------
Status = 1
frmMain.tmrCount.Enabled = True
'--------------------------------
End Sub
tmrCount is a timer on the form 'frmMain', which executes a sub on the form...
Private Sub tmrCount_Timer()
'--------------------------------
Select Case Status
Case 1
tmrCount.Enabled = False
Call DoSomething 'A Form Level Procedure
Case 2
tmrCount.Enabled = False
Call DoSomethingElse 'Another Form Procedure
Case Else
tmrCount.Enabled = False
debug.print "Incorrect Input!"
End Select
'--------------------------------
End Sub
Now, here's the deal: When the sub DoSomething is completed, I want to raise an event to the calling client, informing it that DoSomething is completed. Obviously this has to be done through the class module, however - the class module has no freakin' clue when DoSomething (resident on the form) has completed, so it can't raise an event accordingly.
To try to solve this, I put an event on the form, which could be picked up by the class, which in TURN could raise its own event to asynchronously notify the calling client of the completion of DoSomething.
For some reason unknown to me, the Class does not receive such an event, despite it getting 'raised' on the form. (Form's a yellin', but nobody's a listenin'). Also, raising an event on a form doesn't tell the calling client application either, because it's out of scope.
Also, Upon completion of DoSomething, I cannot call a public sub on the class (to fire an event to the client), because it's out of scope to the form! So the question....
How can I get the form to tell the class when it's done executing a sub, so the class can fire an event to the calling client application?
I know this all may sound kinda roundabout (and there's probably a billion better ways to do this), but it's the only way I've managed to obtain true concurrency between apps, as this is a bio-medical-robotic-multi-3rd-party-hardware application, which must run without any lock-ups, as we're dealing with motion control. These motion control devices (controlled through serial comms and ActiveX Controls) are notorious for sucking the life out your program when a task is instructed, thus expediting the necessity to seggregate their respective responsibilities in the application framework. This is a real problem and I truly appreciate the help guys (and gals).
Muchos Gracias Con Queso!
Peace
Lego
"People have accused us of releasing the same album 16 times - that's simply not true. We've released the same album 17 times!" - Angus Young, AC/DC
Public Sub ExecuteDoSomething()
'--------------------------------
Status = 1
frmMain.tmrCount.Enabled = True
'--------------------------------
End Sub
tmrCount is a timer on the form 'frmMain', which executes a sub on the form...
Private Sub tmrCount_Timer()
'--------------------------------
Select Case Status
Case 1
tmrCount.Enabled = False
Call DoSomething 'A Form Level Procedure
Case 2
tmrCount.Enabled = False
Call DoSomethingElse 'Another Form Procedure
Case Else
tmrCount.Enabled = False
debug.print "Incorrect Input!"
End Select
'--------------------------------
End Sub
Now, here's the deal: When the sub DoSomething is completed, I want to raise an event to the calling client, informing it that DoSomething is completed. Obviously this has to be done through the class module, however - the class module has no freakin' clue when DoSomething (resident on the form) has completed, so it can't raise an event accordingly.
To try to solve this, I put an event on the form, which could be picked up by the class, which in TURN could raise its own event to asynchronously notify the calling client of the completion of DoSomething.
For some reason unknown to me, the Class does not receive such an event, despite it getting 'raised' on the form. (Form's a yellin', but nobody's a listenin'). Also, raising an event on a form doesn't tell the calling client application either, because it's out of scope.
Also, Upon completion of DoSomething, I cannot call a public sub on the class (to fire an event to the client), because it's out of scope to the form! So the question....
How can I get the form to tell the class when it's done executing a sub, so the class can fire an event to the calling client application?
I know this all may sound kinda roundabout (and there's probably a billion better ways to do this), but it's the only way I've managed to obtain true concurrency between apps, as this is a bio-medical-robotic-multi-3rd-party-hardware application, which must run without any lock-ups, as we're dealing with motion control. These motion control devices (controlled through serial comms and ActiveX Controls) are notorious for sucking the life out your program when a task is instructed, thus expediting the necessity to seggregate their respective responsibilities in the application framework. This is a real problem and I truly appreciate the help guys (and gals).
Muchos Gracias Con Queso!
Peace
Lego
"People have accused us of releasing the same album 16 times - that's simply not true. We've released the same album 17 times!" - Angus Young, AC/DC