What is COM and DCOM?

Posted on 2000-02-19
Last Modified: 2013-11-25
Can you tell what is COM and DCOM ?
Also, what are their difference?
Question by:cstsang
  • 2

Accepted Solution

stefanx earned 50 total points
ID: 2537842
COM stands for Component Object Model.
Basically, what this means is that you can write software components that perform a specific job, and then "call" these components from any other programming or scripting language.

Let's take and exaple.
Imagine you keep writing programs that access a database and count how many records are in a specific database table. Each time your write a new program, youcopy and paste your original code. Your boss has just asked you to do this database checking from Microsoft Excel, and you're getting pretty cheesed off having to copy and paste each time.

You could actually rather write a component (in Visual Basic) that does this job. Basically, you may want to tell the component which database to query and you want it to return a long variable that contains the amount of records. Assuming that the component is written and registered in your registry, now all you need to do is allow your program to access this component. In Visual Basic, you do this by going to the Project..Components menu. Add the component in your project, and you can suddenly declare variable instances of the component by saying

Dim X AS New MyComponent.ComponentName
X.DataBase = "c:\My Documents\db1.mdb"
MsgBox "There are " & X.RecordCount & " records."
Set X = Nothing

In Microsoft Excel, you can suddenly use the component in exactly the same manner, while you can also use it from Delphi, C++ or whatever. You can even use it from ASP on your Inter/Intranet Website.

So all in all, writing components makes sense in that you can focus on the job at hand rather than in on all the little common things you need to do. When you debug, you don't have to debug the component each time either, so it makes your life as a programmer easier.

So what is DCOM? DCOM stands for Distributed Component Object Model. What this means is that your program on one machine can "call" a component which actually runs on another machine. Why would you want to do this ?
Well, imagine you write a component that does a really serious job. When you call a method of the component, it takes like 3 hours to run. This is because your boss has given you a 386 with 4MByte of RAM. If you could use his computer (a Pentium 733 with 256M of RAM), it runs in 3 seconds. So it makes sense if you could run the component on his machine, even though you are running the program that needs the component on your machine. This is what DCOM does for you. It will use a network to distribute components across that network. The example may be a bit extreme - a better example is perhaps that you are at home on a modem connection to your work. Your component need to open 1 million records, performs some logic and come back with an answer. Your modem connection is way to slow to try and read 1 million records, but the server at the office is on a fast ethernet connection to the database, so it is easy for that server.
You call the COM component on the office server using DCOM. It does the connection to the database, does the calcs and returns the number to your computer sitting behind the modem.

OK - I hope that helps.


Expert Comment

ID: 2538941
According to your explaination, I can't see a difference between an ActiveX DLL and a COM object! (I really have no idea about COM objects).

Author Comment

ID: 2539347
Can you tell me more detail about these?
Such as which MS product is belong to DCOM and COM

Expert Comment

ID: 2539410

An ActiveX DLL (VB Terminology) is a COM object. But there are also COM+ components. I don't know how they differ from COM objects, but you can read more about it at


Look at the website named above. Of course, Microsoft has a hell of a lot of products, so I can't just tell you which can work with COM and which can't. But basically, any of the programming languages (VC++, VB and maybe VJ++ (I don't know)) can create COM objects. Any of these can also use COM and DCOM objects. All of the Microsoft Products that contain VBA scripting ability can use COM objects (i.e Microsoft Word, Excel, Access, PowerPoint as well as Active Server Pages, Windows Scripting Control and so on). Microsoft Transactions Server (MTS) acts as a resource controller and COM coordinator.

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question