How do you create an ActiveX control at run-time (no form)?

  • Thread starter Thread starter Jink Welby
  • Start date Start date
J

Jink Welby

Can anyone tell me how to create at ActiveX control ar run-time in code
without using a form? I want to instantiate and use the control from within
a non-visual class.

Please help!

Thanks in advance,

Jink
 
Here's what you can try:

1) Reference the DLL containinf the ActiveX as a COM dll. An interop
assembly will be created and added to the project references.
2) Examine the generated assembly with Object Browser to find out which
class corresponds to the control (usually it is named AcmeControlClass if
the control itself is named AcmeControl).
3) Create an instance of that class with the "new" operator.

However, it actually depends on the control itself whether you will be able
to use it in the intended way or not. If all the control code assumes it is
visible, has a window and bounds etc., your attempt will most likely fail.
 
Back
Top