ALT/COM ?

Started by
7 comments, last by DevLiquidKnight 21 years ago
I was wondering what is the main use of ALT/COM is it mostly for like plugins & controls for applications basically what is its MAIN purpose? I also was wondering if anyone had any good sites with info on coding with this; I don't want to make anything really big just fiddle around and see what it can do. coder requires 0xf00d before continue().
Don't click me! Killer Eagle Software [edited by - DevLiquidKnight on May 11, 2003 12:00:46 AM]
Advertisement
ATL is a template library to make windows programming easier.

COM is a technology that allows you to write programs that can interact with eachother and learn about one another.
Pakoo?
Do you have any good examples of when it would be good to use this in programming?

coder requires 0xf00d before continue().

Don''t click me!
Killer Eagle Software
DirectX is implemented fully in COM
daerid@gmail.com
Say you're writing a web page that needs to do a bunch of crazy stuff like use TCP/IP to connect to some other computer near the server to initiate a database backup...

write a COM component in (whatever language here), install it on the web server, and boom... you can instantiate a class from your C++ or C# or whatever component inside ASP or PHP and tell your database to back itself up onto a tape backup drive.

Then if your DBA is off on vacation and wants to make sure everything's backed up, all he needs is a web browser.


OR... say that PHP and SQL Server don't play along very well with the default database interface (which it doesn't... sometimes it has race conditions)... write a quick C# component that acts exactly like the broken interface and viola! Problem solved.


... Why did I mention C# do you ask? Because every C# class that you write is COM compatible. Writing COM components in C++ (by hand without wizards) is quite a bit more complicated.

[edited by - Nypyren on May 11, 2003 12:34:43 AM]

The essence of COM in the IUnknown iterface, it has three virtual methods; QueryInterface, AddRef, Release. Every COM object must implement this interface, along with other interfaces to accomplish its job. If the object implements IDispatch, it is Automation compatible, and can be used with script languages such as VBscript or Jscript.

With COM, you have a set of ''abstract base classes'' which are called interfaces that concrete classes (called coclasses) implement. Through IUnknown->QueryInterface you can ask an object if it supports a given interface.


For an example of real code I use, I have an MFC derived combobox that can list items that support the IMoniker interface. Moniker loosely means ''name'', so if we have a container of named objects, we can list them by name. But when the user selects an object, I have an IMoniker interface, which is not useful to the rest of the application - however the application knows what type of objects it put into the listbox, so it can call QueryInterface to get a useful interface from the IMoniker - such as the DirectShow interface IBaseFilter.

We can then query the object to see if it supports additional interfaces we care about (such as IFileFilter, ISourceFilter, or IRenderFitler).

COM specifies an binary interface for C++ objects, so you can write objects in C++ (using any COMpliant compiler, MSVC or BCB) and use them in VB6, Delphi, Excel VBA, etc...

COM in the next generation of MS software architectre after OLE, and .Net is the next generation after COM. They all build on each other at an architectural level (and even at a design level in some areas).


ActiveX is a set of COM interfaces for implementing and consuming UI controls.

COM+ is an exceedingly poor name for a set of interfaces relating the MTS (MS Transaction Server) and related OS support for it.

DCOM is distributed COM and is a remoting architecture similar to CORBA that is integrated with the COM infrastructure (a bunch of crap written in a certain way in the Windows Registry). You even defined COM interfaces using IDL, but an MS extention of it (you define CORBA interfaces using IDL).

ATL is the Active Template Library, which is template code and a wizard to make implementing COM objects using MSVC earier.

(The WTL is the Windows Template Library and is like the ATL but for core windows programs, a light-weight replacement for MFC.)

ATL, WTL, & MFC were all updated for MSVC7, none have been abandoned.
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
From [1]:


The COM Lifestyle

(sung to the tune of "Limelight" by Rush)

Writing QueryInterface
Approaches the unreal
For those who think and feel
In touch with some reality
Beyond the interface

Casting this to IUnknown
Won''t work with MI
This code is really hacked
One must use a static_cast
To keep QI intact

Living the COM lifestyle
The universal dream
For a distributed team
Those who wish to be
Must focus on the integration
Get on with the distribution
The real intention
The underlying theme

Coding up some IDL
With help from Chris Sells
And writing Windows Shells
I can''t believe that CORBA
Is a long-awaited friend

All the world''s indeed the net
And we write all the objects
Programmers and deployers
Each another''s client
Inside the Internet

Living the COM lifestyle
The universal dream
For a distributed team
Those who wish to be
Must focus on the integration
Get on with distribution
The real intention
The underlying theme


[1] http://www.sellsbrothers.com/fun/

...and that is why I believe linux must be destroyed.
--AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.[Project site] [IRC channel] [Blog]
Intresting I find com & alt programming to be somewhat complex and abstract to how im used to coding. Do you have any sites that give good tutorials on this?

coder requires 0xf00d before continue().

Don''t click me!
Killer Eagle Software
quote:Original post by DevLiquidKnight
alt programming

A-T-L
--God has paid us the intolerable compliment of loving us, in the deepest, most tragic, most inexorable sense.- C.S. Lewis

This topic is closed to new replies.

Advertisement