PDA

Click to See Complete Forum and Search --> : Raise event array


kdx
Feb 19th, 2001, 04:43 AM
Hi,
I`m trying to get a client program to detect events of an array of activex exe's.

Something like tis doesnt work.

Dim WithEvents Obj(10) As clsAXE

Would I have to use a ActiveX Control instead ?

Thanks

simonm
Feb 19th, 2001, 08:08 AM
You cannot declare control arrays with events either.

kdx
Feb 19th, 2001, 08:54 AM
Oh great any solutions ?....... how is it done with other controls ? Because if its "load"ed it will add "Index" within the event ?

simonm
Feb 19th, 2001, 09:00 AM
Controls that are dropped on a form can easily be made into a control array with codeable events.

Nothing 'special' needs to be done to achieve this.

You just cannot declare an object variable array with events.

Feb 20th, 2001, 05:24 AM
You will need to create some sort of feeder object that all the Exe's talk to, and your app has a single reference to.

The feeder object has subs that match the events that the exe's will raise. the exe's, instead of rainsing the event, call the feeder objects event sub, and the feeder object then raises the event out to the controlling program. The active exe will need to know about the feeder object - you will have to pass a reference to the feeder object to the active exe whenever one is instatiated (like a paretn refernce so to speak). This way the exe knows where to call the evetn sub, which in turn raises the event out to the calling sub. Each exe will require a unique key, which needs to be passed out through te feeder objects evetns, and you program then interoprets the events, and knows which Exe raised that event based on the key.

Hope that makes sense - it's a bit of a complex concept

- gaffa

kdx
Feb 20th, 2001, 06:50 AM
u what ? Sounds alot more complicated, but interesting, do u have example code........... :-)

kdx
Feb 20th, 2001, 06:58 AM
.... can an activex exe, refenence its client program ? how ? ............

Feb 20th, 2001, 07:46 PM
i agree with gaffa, who commits to the feeder idea...however i would use more appropriately a "wrapper" ..in other words a class who's sole
purpose was to wrap the Exe calls in a class and
assign the "event" out to each individual EXE....
the assignment could be done with Select Case statements....etc...you might even use Properties to handle the Exe calls so that you would feed the Exe's to the class properties and that would allow you to reuse this class with other Exe's in the future..make it generic so that it does not tie into those exact Exe's but simply get's the Exe name and path fed into it and then...viola you have a truly useful object..

kdx
Feb 22nd, 2001, 12:05 PM
ok.... so how do i access the slave program from the activex exe ?

Feb 22nd, 2001, 12:43 PM
by adding code within the Exe to "Dim" and "Set"
an instance of the wrapper class, how you choose to build and call that instance is up to you to design into your program.

Remember since you have built this class as a wrapper object it can be called by anything that can call objects
even future projects ..possibly by placing it into a DLL
and then referencing it in any future project..

huggy
Feb 27th, 2001, 11:42 PM
gaffa,

'Scuse the interruption, but is it possible to have a non-child (already launched) application event signal another process through the event subroutine system? How?

Ie, how can I have a non-child application run an event sub in my app? I can't use Set x = NEW y, since it launches another instance of the app.