views:

1407

answers:

3

Hi all, I'm looking at getting into ActiveX development and hopefully make a couple browser plug-ins by the end of things. I'm a seasoned WinAPI developer who has stayed away from such wrappers as MFC and ATL in the past, so I have virtually no experience in either area. However, in searching for tutorials on creating ActiveX controls in C++, they almost invariably involve either one of those two standards, which wouldn't work for me. My question is, is it possible to create an ActiveX control (suitable for embedding in IE) without touching MFC or ATL? If so, does anyone have any good references or tutorials I could read on the subject? If not, what do you guys recommend as my best path forward? How hard would it be for me to pick up VB and do things that way?

Thanks in advance

+5  A: 

Yes, it's definitely possible but not for the faint of heart. I would recommend books by Don Box (Essential COM) to learn about the fundamentals of COM.

MFC and ATL and other framework have a lot of plumbing already in place that you're free to replicate yourself if you like.

Greg Hewgill
Whoops duplicated - have deleted my answer
Preet Sangha
Thanks. I should add that I did finally find page which discusses making ActiveX objects without MFC/ATL/etchttp://programming-tutorial.cn983.com/ActiveX_Programming_with_Visual_C/ch14.htm
GRB
+1  A: 

Don't do it! ATL is pretty useful for dealing with COM, especially if you're going to be doing anything related to a user interface or reusable control. It's just not worth the time and effort, and it would be a ton of effort (there's lots of ATL functionality that you'd need to duplicate). ATL really really is a very good way to do COM.

Note that ATL includes some basic Windowing/GDI support, and WTL expands on this. WTL is also pretty dang good.

Try and find these books:

  • ATL Internals (huge ++++ on this one)
  • Wrox Visual C++ ActiveX/COM control programming (surprising good for a wrox book)
  • Active Template Library a Developers Guide (not as good as ATL Internals but still pretty useful)

Essential COM is ok if you're doing lots of low level COM stuff... but frankly I spent a lot more time in the above books.

These are all really old... but I found them very useful (I've got a few ActiveX controls that run only from IE).

On whole IE is a pretty good control container and I didn't have much trouble with it. Deployment is the only tricky part, and it's only tricky if you're trying to deploy the controls as part of a web application. If I was doing it over again I would start with a very simple ActiveX who's sole responsibility would be to report the currently installed version of the .DLL. And I'd never ever change this control (other than to update the version number). This control would allow for easy verification of what version of the .DLL is/is not installed from JavaScript (IE kind of handles this for you... but not in a particularly brilliant way).

ATL Internals has a nicely updated 2nd edition published in 2006, and I agree that Tom Armstrong's "ATL Developer's Guide" (the 2nd edition of "Active Template Library - a Developer's Guide") is another good book on the subject. Finally, Troelson's "Developer's Workshop to COM and ATL 3.0" is another really good book on ATL/COM.
Michael Burr
A: 

Yes, you can. For example ActiveX of VLC created on C++ without MFC and ATL. This is example: ActiveX without MFC and ATL