Board index » cppbuilder » Wrapping ActiveX control in custom VCL-component

Wrapping ActiveX control in custom VCL-component

I am trying to create a custom panel to host an ActiveX control
(MS-DHTMLedit control). The problem is that I don't know how to
instantiate the control dynamically and to set its properties (Top,
Left, Width, Height).
I saw some threads in this newsgroup that came close to this subject,
but either I didn't grasp them or they didn't work for me.
Is there anyone who did something like this? What am I missing?

Thanks in advance,
Willem.

 

Re:Wrapping ActiveX control in custom VCL-component


Willem, see if this code gives you an idea.

      wb = new TWebBrowser( this );
      wb->OnProgressChange = WebBrowser1ProgressChange;
      wb->OnStatusTextChange = WebBrowser1StatusTextChange;
      reinterpret_cast<TWinControl*>(wb)->Parent = VCLWindowedComponent;
      wb->Align   = alClient; // or set wb->Width = 100; wb->Height =
100;, etc.
      wb->Visible = true;

All you need to do is import the MS_DHTML editor ActiveX control and
#include _ocx.h file in your .cpp file. Also, add _ocx.cpp file to the
project.

HTH,
Alex

Quote
Willem Jongman wrote:

[snip]

Re:Wrapping ActiveX control in custom VCL-component


Quote
> #include _ocx.h file in your .cpp file. Also, add _ocx.cpp file to the
> project.

Thanks a lot Alex, this was the part I was missing, I saw your snippet
before, but I couldn't get the thing to compile because I included the _tlb
instead...

I never really went through the _ocx files, but now I see that TDHTMLEdit is
derived from TOleControl, which derives from TWinControl, and now I
understand the ugly typecast too.

And while typing this, I suddenly see a lot of possibilities, I am going to
do a lot of programming this weekend :-)

regards,
Willem.

Re:Wrapping ActiveX control in custom VCL-component


Willem,
glad you will be busy :)

Alex

Quote
RetouchLab wrote:

[snip]

Other Threads