Solved

What is COM and DCOM?

Posted on 2000-02-19
4
2,164 Views
Last Modified: 2013-11-25
Can you tell what is COM and DCOM ?
Also, what are their difference?
0
Comment
Question by:cstsang
  • 2
4 Comments
 
LVL 8

Accepted Solution

by:
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.




0
 
LVL 7

Expert Comment

by:kamall
ID: 2538941
stefanx,
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).
0
 
LVL 7

Author Comment

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

Expert Comment

by:stefanx
ID: 2539410
Kamall:

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 http://www.microsoft.com/com

cstang:

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.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

707 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now