Click to See Complete Forum and Search --> : ActiveX Multiple instances
Sulman1
Oct 27th, 2004, 09:47 AM
Hi All,
I am developing an ActiveX at the mo. What I would like to be able to do is when the activex is placed on to a form (probably in UserControl_Initialize() function) is to determine if there is another instance of this activeX on the form already. If there is then I can expose some properties/methods for communicating between the two.
Any thoughts? Is this possible?
Cheers
Calibra
Oct 27th, 2004, 12:55 PM
Originally posted by Sulman1
Hi All,
I am developing an ActiveX at the mo. What I would like to be able to do is when the activex is placed on to a form (probably in UserControl_Initialize() function) is to determine if there is another instance of this activeX on the form already. If there is then I can expose some properties/methods for communicating between the two.
Any thoughts? Is this possible?
Cheers
Possible?, probably yes,
adviseble> NO, most likely to end in an infinite loop between the 2 component's.
Add an function to the form to check if more than one exists and handle the communication between the component's there.
I even think it goes against the rules of ActiveX to incorparate such an function in an ActiveX component.
Dave Sell
Oct 29th, 2004, 02:58 PM
Originally posted by Sulman1
Hi All,
I am developing an ActiveX at the mo. What I would like to be able to do is when the activex is placed on to a form (probably in UserControl_Initialize() function) is to determine if there is another instance of this activeX on the form already. If there is then I can expose some properties/methods for communicating between the two.
Any thoughts? Is this possible?
Cheers
Yes. Each could hold a reference to another VB6 object, called a Singleton. There is only one instance of the Singleton, and many clients can all hold a reference to the same object.
I go into it in some detail here:
http://www.vbforums.com/showthread.php?s=&threadid=310103&highlight=Singleton
Go to the very last post of mine and check out the SimulBrowse Singleton.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.