Solved

What is COM and DCOM?

Posted on 2000-02-19
4
2,230 Views
Last Modified: 2013-11-25
Can you tell what is COM and DCOM ?
Also, what are their difference?
0
Comment
Question by:cstsang
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VB6 - Convert HH:MM into Decimal 8 76
Export Data to Different .csv Files 27 133
VBA - If Bookmark = "XXBOOKMARKXX" then 15 67
Error in Visual Project 10 48
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

739 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