I've never worked with COM before, and I've been tasked with writing an application that uses some third party COM objects. If anyone could point me to some good tutorials on how to use them it would be much appreciated. More immediately, it appears that I don't have the Active Template Library installed. I've searched online but can't figure out how to get it.
As Dan pointed out, these are distributed with Visual Studio.
If you don't have Visual Studio, you can get the ATL libraries from one of the Microsoft Visual C++ Redistributable packages:
- 2005 SP1 (32-bit)
- 2005 SP1 (64-bit)
- 2005 (Itanium)
- 2008 SP1 (32-bit)
- 2008 SP1 (64-bit)
- 2008 SP1 (Itanium)
Note: The ones marked 2005 are version 8 (atl80.dll), the ones marked 2008 are version 9 (atl90.dll).
It's part of Microsoft Visual Studio (but not the Express Edition.)
As Dan pointed out, these are distributed with Visual Studio.
If you don't have Visual Studio, you can get the ATL libraries from one of the Microsoft Visual C++ Redistributable packages:
- 2005 SP1 (32-bit)
- 2005 SP1 (64-bit)
- 2005 (Itanium)
- 2008 SP1 (32-bit)
- 2008 SP1 (64-bit)
- 2008 SP1 (Itanium)
Note: The ones marked 2005 are version 8 (atl80.dll), the ones marked 2008 are version 9 (atl90.dll).
I think you have to own a copy of Visual Studio 2005 or 2008 (not Express) to get ATL. If you have one of those installed, but you don't have ATL then go to "Control Panel:Add/Remove Programs" and do a "Modify" install (with the program CD or DVD in the drive) and make sure the box for ATL is checked.
As for tutorials:
I haven't found a really good one online. There are a few OK pages on using ATL/COM:
- The Active Template Library Makes Building Compact COM Objects a Joy by Don Box (veteran guru of COM). This article starts: "I love COM. COM is good. Like a fine pilsner or ale, COM never disappoints. In fact, the more I look at COM, the more I like it. Unfortunately, I work in C++, and C++ does not share my appreciation for the finer things in life." Despite the Grand Master's proselytizing, and the fact that it's 12 years old now, it's a pretty good article...
- Mike Dunn's excellent tutorial on COM on CodeProject.
- DevGuy's C++ COM Tips -- kind of a hodgepodge of links and suggestions.
- The COM Programmer's Cookbook -- this ancient (1995) article isn't bad, despite its age and the fact that it describes implementing COM objects in C rather than C++ (explicit vtables!)
I'm a little rusty myself w/ COM and ATL, but if I remember right, the classes you're going to want to learn that you'll use the most (especially if you are using someone else's COM objects rather than implementing your own) are CComBSTR, CComPtr, and CComVariant. Also the #import statement in Visual C++ makes using external COM objects much easier, it generates a smart pointer class for you from an external DLL or EXE.
If you're going to be implementing COM objects, I would strongly recommend getting a copy of ATL Internals (there's a newer edition out now covering ATL v8). Yes it does go into some gory detail in sections, but even as an intro book it's fairly well written.
If you've never used COM before, the "classic" books Essential COM and Effective COM are very good and you can probably get them inexpensively from your favorite sources of used books. You're also going to want to be very familiar with the RAII idiom, if you aren't already.
The newsgroup microsoft.public.vc.atl is very good for asking particular questions. (they tend to be more gruff there than on StackOverflow, though)
Beware: There are lots of little gotchas with COM, although ATL does help it become a lot easier & without a lot of bloat. The "simulated dynamic binding" techniques aka CRTP are useful in the C++ world, not just in the context of ATL/COM but especially if you are developing a library of reusable classes that you want to subclass or mixin in situations where only one instance is present at a time (e.g. a class CSpiffyFramework that provides mixin functionality that you want to reuse a lot, and you have a derived class that you want to include that functionality, and it's not part of a virtual object model so you don't really need a vtable).
Good luck!
I installed this: http://www.microsoft.com/en-us/download/details.aspx?id=3138 and got the C++ compiler and all stuff on my buildserver, but no ATLMFC libraries. The redist packages linked above is just that, redistributables, not the headers and includefiles needed.. After lots of searching, I ended up installing vs2008 on the server, crap.
here is how to use atl with vs express:
you need WDK 7.1.0:
https://www.microsoft.com/en-us/download/details.aspx?id=11800
Download Visual Studio Express Edition
Get VS Express C++ free from Microsoft
Download the freely available Windows Driver Kit (7.1 or later) from Microsoft
Get WDK 7.1.0 free from Microsoft
You can mount the ISO file with Virtual Clone Drive or extract it with 7-zip.
Install the WDK and select the "Build Environments" option
This will install the ATL and MFC header and lib files. ATL is a requirement for FireBreath on windows. Make sure to install this in the default location so that FireBreath can find it
For VS Express 2010
If you are using an older version of FireBreath, this post by scjohn may be useful for you. Note that FireBreath 1.4 beta 1 and later these steps are no longer needed!
http://www.firebreath.org/display/documentation/Building+with+Visual+Studio+Express
[vs2010 express include path]
C:\WinDDK\7600.16385.1\inc\atl71
[vs2010 express lib path]
C:\WinDDK\7600.16385.1\lib\ATL\i386
_ATL_VER=0x0800
which corresponds to Visual Studio 2005. Not only it does not make sense for development with current toolsets, the code does not have to even compile and does not have to run safely (2005 ATL has DEP related issues in particular). –
Tarsus © 2022 - 2024 — McMap. All rights reserved.