views:

161

answers:

1

Hi all,

I'd like to use an activeX component in Visual C++. The ocx file has been registered and I can insert the component in a dialog of the resource editor. But how I get a wrapper class to use the activeX object now?? On MFC applications, the editor creates a wrapper class for the ocx, but I'm not using MFC...

Thanks! Henry

A: 

The hosting of ActiveX controls is a right royal pain. Basically, outside of some very thick tomes, there is no easy documentation on how to write a correct ActiveX host from scratch.

Start by taking a peek at webhost here: http://www.mvps.org/user32/ This was my experiment in creating the least amount of framework that could still host a shell.explorer ActiveX control.

The "core" API function to get you started down this road of madness is OleCreate - this will create a control given its CLSID, and a pointer to an IOleClientSite implementation thats going to be the, well, site for the control and some kind of IStorage implementation.

Chris Becke
You could at least link to the relevant part of your website instead of using this as a shameless pitch to promote your other outdated content.
Eric
I wish it was a shameless pitch. As it was I had to google for my own - outdated - site. I have all but abandoned it. It does host a cab file with sample code in it that will do what the question asked. If I could have thought of any way to explain, on stackoverflow, how to implement an activex container from scratch in c++, I would have. Really.
Chris Becke