ActiveX Control Destruction

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

ActiveX Control Destruction

Runar Jordahl-2
I am using an ActiveX control, which, due to the license, only allows four
"instances" to be active at any given time. Below is an example of how I
create the control and invoke a function:

site :=AXControlSite  progId: 'MP3PLAY.Mp3playCtrl.1'.

mp3Control := site controlDispatch.

mp3Control aboutBox.

Now, if I keep evaluating the code above, the control will not work the
fifth time. It seems like "destruction" of ActiveX controls must be handled
explicitly, and that normal Smalltalk garbage collection will not destroy
instances created. If I however exit Dolphin Smalltalk and restart again, I
am again allowed to invoke functions on the control.

My question is, how do I "destroy" an instantiated ActiveX control from
Dolphin Smalltalk?

Below is the assistance I received from the creators of the control, when
asking how the control should be deleted:If you have a knowledge about C++
language, the proportion would be: "control creation" : "new statement" =
"control destruction" : "delete statement"


Reply | Threaded
Open this post in threaded view
|

Re: ActiveX Control Destruction

Runar Jordahl-2
Seems like the two last statements in the code below will correct my
problem.



site :=AXControlSite  progId: 'MP3PLAY.Mp3playCtrl.1'.

mp3Control := site controlDispatch.

mp3Control aboutBox.

site close.

site := nil.



Runar Jordahl


Reply | Threaded
Open this post in threaded view
|

Re: ActiveX Control Destruction

Blair McGlashan-3
"Runar Jordahl" <[hidden email]> wrote in message
news:41f531e3$[hidden email]...

> Seems like the two last statements in the code below will correct my
> problem.
>
>
>
> site :=AXControlSite  progId: 'MP3PLAY.Mp3playCtrl.1'.
>
> mp3Control := site controlDispatch.
>
> mp3Control aboutBox.
>
> site close.
>
> site := nil.
>

Yes. OCXs (Active-X controls with visuals*) are Windows and need to be
closed explicitly. In Dolphin this amounts to closing (or destroying) the
control site Window.

Regards

Blair

*Quite a lot of Active-X controls that should be non-visual are implemented
as OCXs even though they have no GUI at runtime. This is often done so that
the component can be placed in GUI painter toolboxes (e.g. in VB). In order
to avoid having to explicitly close the site you could go with the flow and
drop a site on your view. If you switch the control out of design-time mode,
it should not be visible at runtime, or you can hide the site. If the site
is hosted in some shell window, directly or indirectly, then it will be
closed when the window is closed.