ActiveX Controls and
Control Hosting
ATL
is still the best way to implement ActiveX controls, and you don't
need to change anything to get your ATL 3 ActiveX controls to
compile under ATL 8. In addition, the ActiveX control-hosting
support has been improved significantly in ATL 8.
Readers of the previous edition of this book
might remember that the chapters on ActiveX controls and control
hosting spent several pages describing bugs in ATL 3, and the code
downloads included functions and classes to work around these
errors. I'm very happy to report that somebody at Microsoft
apparently read a copy of ATL
Internalsmost of those bugs have been fixed.
Stock properties now provide a callback function
that you can override to detect when the stock property is changed.
This means that you no longer have to completely replace the
put_XXXX stock property methods that the
CStockPropImpl base class provides.
The AtlIPersistPropertyBag_Load method
has been fixed, so you no longer need the updated function included
with the first edition downloads.
The ActiveX hosting classes have been
significantly cleaned up. The first edition of this book included a
class named CAxWindow2 that fixed several memory leaks in
the control hosting. These leaks have now been fixed. ATL 8 also
includes a class named CAxWindow2; luckily, it's a drop-in
replacement for the ATL Internals class of the same name, so all
you need to do is remove the patched version from your project. ATL
8 ActiveX Hosting also now supports the creation of licensed
ActiveX controls. The new CAxWindow2 class provides the
support for creating licensed controls, but it works just fine for
nonlicensed controls as well.
Take a look at Chapters 11, "ActiveX Controls," and 12, "Control Containment," in
this edition for the full scoop on ActiveX controls.
|