OOPortal OOPortal

Basic COM   «Prev  Next»
Lesson 5 Course project
Objective Understand the course project requirements.

Client Phone Book Course Project

COM Fundamentals I teaches COM fundamentals in the context of the building of a simple phone book and client. This project will consist of a COM server dynamic link library (DLL) that implements a COM object called PhBook.
PhBook is a COM object that implements two COM interfaces - IReadPhBook and IManagePhBook. IReadPhBook provides functions to get phone/address book information. Interface IManagePhBook provides functions to add, delete, and update address records. COM object PhBookObj is contained in an in-process COM server called phbook.dll.
PhCliXX is a COM client that uses interfaces IReadPhBook and IManagePhBook in COM object PhBook.
Copies of the course project for Visual C++ 5 and Visual C++ 6 are on the resources page. Just click the Resources button on the toolbar to the left for this information.

Historical note on ActiveX

The coolest thing about ActiveX is that it enables you to easily build the capability to manipulate many types of data into your applications. You might snicker at the word easily, but it is true. It is much easier, for example, to give your application the capability to contain ActiveX objects than it is to build word processing, spreadsheet, or graphics-manipulation capabilities into your application.
ActiveX fits very well with Delphi's tradition of maximum code reuse. You do not have to write code to manipulate a particular kind of data if you already have an OLE server application that does the job. As complicated as OLE can be, it often makes more sense than the alternatives. It also is no secret that Microsoft has a large investment in ActiveX technology, and serious developers for Windows 95 and other primitive operating systems will have to become familiar with using ActiveX in their applications. COM was the technology used until DOT.NET came along.

OLE 1 Versus OLE 2

One of the primary differences between OLE objects associated with 16-bit OLE version 1 servers and those associated with OLE version 2 servers is in how they activate themselves. When you activate an object created with an OLE 1 server, the server application starts up and receives focus, and then the OLE object appears in the server application, ready for editing. When you activate an OLE 2 object, the OLE 2 server application becomes active inside your container application. This is known as in-place activation or visual editing. When an OLE 2 object is activated, the menus and toolbars of the server application replace or merge with those of the client application, and a portion of the client applications window essentially becomes the window of the server application. This process is demonstrated in the sample application in the "TOleContainer" section later in this chapter.