When Visual Basic 1.0 first came out, there were two things I saw in it that I found really exciting.
First, Visual Basic encapsulated Windows to such a degree that anyone could quickly learn to create a Windows program. Today we sometimes forget how difficult it was to write Windows programs back in 1991. The really nice thing about VB was that even as it hid the complexity of Windows, Microsoft made it possible to make direct API calls so programmers could still take advantage of the full power of Windows. In fact, I liked the idea so much that I wrote two books about it (the original Visual Basic Programmer's Guide to the Windows API, ZD Press, 1993 and then its successor, the Visual Basic Programmer's Guide to the Win32 API, ZD Press, 1996).
I was also thrilled with the idea of custom controls. I had spent some time working as a hardware engineer and was well accustomed to the idea of building complex hardware out of components-integrated circuits that had a clearly defined electrical and functional interface. The idea of building applications out of software components was quite appealing. The idea of creating them even more so. In fact it was so appealing that I founded a company with the express purpose of creating components-specifically, the kind of components that other Visual Basic programmers could use to take full advantage of Windows. (See the common theme?)
It should be no surprise that I find Visual Basic 5.0's ability to create custom controls (now called ActiveX controls) to be possibly the most important feature in the language. The minute I heard that this feature would be included, I decided I wanted to channel my efforts toward helping Visual Basic programmers learn this technology and create the coolest and most advanced controls possible.
Part of this goal is fulfilled in the new tools from my company that extend the reach of ActiveX controls as implemented in VB. The other part is this book. In fact, I was originally thinking about writing a book that focused only on creating ActiveX controls, but I quickly realized that you can't really write great controls without a good understanding of code components and ActiveX technology in general. Besides, now that code components support events, there are many tasks that were traditionally implemented by controls that are now better suited for code components. You have to understand how to create both in order to evaluate the trade-offs involved when you make your own design choices.
It is with those trade-offs that any discussion about ActiveX controls must begin.