Fog Creek Software
Discussion Board




New MFC Project and COM?

Hi,

We're about to start a new project using MFC and hopefully COM. Does anyone have recommendations on books or websites?

Also, I've been reading very different views on using ATL to simplify COM -- what are people's opinions on that?

Cheers
Jedi

jedidjab
Thursday, June 12, 2003

"...hopefully COM" -- ha ha ha, nice one!!!

A *new* project using MFC/COM? Any partcular reason why?

Duncan Smart
Thursday, June 12, 2003

I was on the team that implemented COM inside CorelDRAW (back when I was a co-op / new grad). Obviously I wasn't involved in any of the architecture, but I did gradually learn more and more about it and it seemed pretty interesting (albeit it introduces another layer of bugs and can be hell to debug).

Fast forward to some years later, and I'm in a company that's starting a project that will hopefully become part of a suite of products. Since we're already planning integration between the applications, COM seemed like a nice way to go. It also gives us a way to run automated testing through VB scripts.

I'm open to suggestions :)

jedidjab
Thursday, June 12, 2003

MFC does do COM, but the way MFC does it adds a lot of confusion and limitations to the process - limitations that really start to chafe if you need to do more advanced COM stuff.

ATL CAN be used in an MFC project. In fact, if you're dead set on doing an MFC project I'd say use MFC for the GUI stuff and ATL for the COM stuff.

However, ATL does take a better level of developer to understand and take advantage of it. If your teammates aren't comfortable with C++ templates and are totally confused when they see:

  template< class Base >
  class MyImpl : public Base {
  ...
  }

then you should expect a fairly big training burden with ATL.

Chris Tavares
Thursday, June 12, 2003

I recommend ATL Internals by Rector and Sells.  It's well written and has great coverage over the things you need to know.  Even if you end up using MFC, many of the concepts apply.

Alyosha`
Thursday, June 12, 2003

For COM

Beginners:
Inside COM, Rogerson

Advanced:
Essential COM, Box
and the COM Specification, available on Microsoft's web site (http://www.microsoft.com/com/), plus msdn has literally hundreds of articles on the subject.

If you're going to be using C++, then using ATL makes life much easier. The usual recommended beginners books on ATL (if there is such a thing as beginners books on ATL) are "Developer's Workshop on COM and ATL 3.0" by Troelsen and "Professional ATL COM Programming" by Grimes. And for the real details "ATL Internals" by Rector and Sells. There's supposed to be a new edition of this, but I haven't seen it (Sells also has a web site, http://www.sellsbrothers.com/ with quite a lot of ATL/COM information).

There are many more books around; like always, pick the one whose author's style appeals to you.

Also, don't forget there's nothing wrong with writing COM in Visual Basic, you just don't get the same fine grain of control. Pattison's book, although more oriented to COM+, is good for this.

Good luck, you'll need it, it's a steep learning curve.

Pietro
Friday, June 13, 2003

Thanks for all the advice .. I'm probably going to pick up the Troelsen book as a start and go through it. Luckily the project isn't starting immediately, so I do have some time to research the subject.

jedidjab
Friday, June 13, 2003

You might want to consider WTL rather than MFC, it is very similar to ATL in its use of templates and much nicer than MFC. You won't find any books on it though!

Tony E
Friday, June 13, 2003

Hmm..I'm a bit confused by a few people's comments on MFC. If you were starting a brand-new Windows-only application based on documents, wouldn't you use MFC? It seems like a lot of extra code to write it with the Win32 API (and I'm not familiar with WTFL yet).

From most of the discussions on the boards, it appears that starting a project in .NET right now doesn't offer much of an advantage, especially with the huge download required for most end users. Am I missing something?

jedidjab
Friday, June 13, 2003

I started an app with MFC on 3rd Feb this year. Almost done now

My app target Win95 and up. But it uses stuff like the new common dialogs when available on the system etc.

The market won't care that I'm not using some new fangled programming language

They will care they don't have to download the net framework

They will care my app is super fast,  feature-packed and ready now (okay real soon)

I never understood the arguments which begin "MS just released a new programming language, therefore I must do...".  It seems to me, it's always better to start with "I want to do..." and then figure out how. In my case a "traditional" MFC/C++ app [doc/view all that stuff] was, I considered, the best way to do it.

So in summary, I think MFC is still a reasonable choice for a lot of apps.

S. Tanna
Friday, June 13, 2003

I once fired up VS.NET 2002 and ran all of the AppWizards to get skeleton GUI app.

The MFC app was the only app that had the new WinXP controls.

I found this amusing, considering how new and fandangled .NET is.


Friday, June 13, 2003

That's easily solved by creating a .NET application "manifest" that tells the app which version of the common controls to load...

Chris Nahr
Saturday, June 14, 2003

You should really evaluate whether or not COM and MFC are good choices for this project.  Is the application going to be distributed on a local intranet where the computing environment can be controlled relatively easily?  If so maybe you should evaluate .NET for this project.  I agree that there is very little reason to get started on end user apps that employ .NET at this point because there is very little impetus for an end user to download the runtime, but if your app will not be deployed for a year or so then .NET starts making a lot more sense.  I am a huge fan of COM (not so much MFC) and ATL so it hurts to say all of this.  COM will continue to play a big role on the Windows platform for years to come but .NET was designed as a COM killer with the ease of interop between .NET and COM.  Now if you are writing a document centric app then MFC does make sense but there are lots of ways around that (rolling your own is not such a bad idea).  I just hate statically depending on a monster as huge as MFC in anything I do.

Lonnie McCullough
Tuesday, June 17, 2003

*  Recent Topics

*  Fog Creek Home