PC Magazine

  PC Tech

COM Objects in Delphi, Part 1

Introduction

COM object essentials

Satellites and Containers

Satellite objects

Container objects

The Class Factory

GUIDs, CLSIDs, and IIDs

Figure 1

 
  Categories:
Programming
COM Objects in Delphi, Part 1
What it takes to overcome Delphi's lack of multiple inheritance

By Neil J. Rubenking  

The PC software development community is segregated by platform and programming language. I program with Delphi for Windows, you program in assembly language for DOS, and she programs in C++ for OS/2. Expertise developed on one platform doesn't necessarily apply to another, and skill in one programming language may actually hinder learning another. And interprocess communication, which has the potential to break down these barriers, is made difficult by differing internal representations of data.

But there is one way to bridge the gap--with a language-independent, cross-platform standard for communication between objects: Microsoft's Component Object Model (COM). And COM is here now; it's the essential technology underlying OLE and ActiveX.

Unfortunately, the current literature's COM programming examples don't demonstrate much language-independence. All but a very few use C++. Some examples are straight C++ code and take advantage of the language's multiple inheritance. Others are built on MFC and rely so heavily on COM-specific macros that the result isn't even recognizable as C code. The bottom line: If C++ isn't your development language, you're at a disadvantage when it comes to learning COM programming.

In this column and a follow-up, we'll discuss the implementation of COM objects using Borland's Delphi development environment. This first part explains the problems involved in a Delphi COM implementation and demonstrates some solutions. The next article will show five specific COM objects--implementations of five standard Windows 95 shell extension types. Under some circumstances, COM objects can reside in .EXE files. But for the sake of simplicity, this article will deal with only the more commonly used COM objects that reside in DLLs.

Continues...

Published as Power Programming in the 01/07/97 issue of PC Magazine.


 SPONSORED LINKS
Finance   Save now, save later - 9.99% Visa card - NOT an intro rate.
Shopping   Buy a 56K modem for $19.95 after rebate from NetMarket!
Software   X10.com -- The SuperSite for Home Automation
 ZDNET FEATURED LINKS
Freeware   It's a software free for all - 100 FREE downloads!
Contests   Enter to win a FREE multimedia PC from ZDNet!
 MAGAZINE OFFERS
Free Trial   Try the next issue of Computer Gaming World FREE!

TOP
Copyright (c) 1997 Ziff-Davis Inc.