Summary
In this chapter, I showed you how to create in-process and out-of-process COM automation servers. You saw how the type library plays an integral part in creating automation servers. This chapter pulled together all the topics we studied in earlier chapters into one cohesive unit.
I also discussed the role that variants play in COM automation, and how they are used to permit late binding to an automation object.
After showing you the basics of automation servers, I showed you how to implement COM events and callbacks in two different ways. You learned that implementing events through dispinterfaces is the most compatible method to use, but creating callback interfaces can be more efficient if you know that both the server and client provide interface support. Delphi 5 improvements to COM event handling make parts of this section obsolete.
Finally, I wrapped up the chapter with a section on Microsoft ADO. The goal of that section was not to make you a proficient ADO programmer, but rather to show you how you can use Delphi to relatively easily take advantage of emerging COM-based technologies. Delphi 5 provides a number of ADO components that you should use when writing applications that make use of ADO, but the general concept of importing type libraries into Delphi applies to automation servers in general.
After reading this chapter you should know the difference between interfaces, dispinterfaces, and variants. You should be armed with the knowledge you need to determine which of the three access methods is best for a particular programming situation.
In the next chapter, I'll discuss ActiveX controls and ActiveForms. You'll learn how to convert a VCL control to an ActiveX control. I'll also show you how to create a small application and distribute it as an ActiveForm.