Solved

Activex Controls

Posted on 1998-11-23
2
200 Views
Last Modified: 2013-12-14
I want to know the difference between creating a control through ATLComAppWizard and MFCActivexControl wizard.To my knowledge the later uses MFC and ATL won't use MFC.

More info??
Thanx
0
Comment
Question by:anilkumarv
2 Comments
 
LVL 8

Accepted Solution

by:
Answers2000 earned 0 total points
ID: 1178527
MFC is a big _fat_ library with lots of functionality.  When you use MFC a big DLL is required to run your control, (or you can link the MFC library statically).  Adding about 1Mb to the download size.  However using MFC makes it much easier to add other Windows functionality (e.g. dialog boxes, graphics, ODBC data access, etc) to your control.

ATL is a small library without much functionality, except for writing OCX.  Basically with an ATL control you have to write all the Windows functionality from scratch using SDK style code (hard work).  The advantage is that your control is small to download.  However remember if you control includes lots of Windows functionality, you basically end up writing your own mini-MFC-like  framework - so don't underestimate (a) the amount of extra of work that may be involved for writing with ATL - also overestimate (b) the reduction in control size - for large sophisticated controls - this may be less than you think - because extra code is required from you.  

Another advantage for using ATL, is that if your control is usually quicker to instantiate (MFC doesn't have to be loaded into memory).  If you invoke the same control a million times in quick succession, using ATL.

Some people also think the ATL wrapper round COM is nicer than MFC's.  Personally I think there's not much in it.  Because of this, it's actually possible to write an ATL control, that uses MFC too.  This ofcourse negates any reduction in size advantage (because the big fat MFC libraries are still required).

Finally MFC can also be used to write full Windows apps.  ATL does not have any support for that.

One other

So in summary

MFC Controls
--------------------
For :
Easy to write (large supporting framework)
Easy to migrate existing MFC apps
Easy to share code with existing MFC apps

Against:
Large download size (requires MFC statically linked, or MFC DLLs)
Slow to invoke (MFC must be loaded)

Use if
(a) You have an existing MFC app/code you want to convert to a control
(b) You know MFC
(c) You care more about development time, than download time


ATL
--------
For:
Small downloads
Quick to invoke

Against:
Harder to write (you must call SDK/API style functions to do work)

Use if
(a) You care less about development time, than download time


ATL + MFC
-----------------
For :
Easy to write (large supporting framework)
Easy to migrate existing MFC apps
Easy to share code with existing MFC apps

Against:
Large download size (requires MFC statically linked, or MFC DLLs)
Slow to invoke (MFC must be loaded)

Use if
(a) Migrating/Transitioning MFC code to ATL
(b) You like ATL's wrapper on COM better than MFC


One last point, if you control is only ever gonna be hosted by an MFC app, you should consider putting C++ classes into an MFC extension DLL, and forget using a control.  The advantage for this is speed, performance and ease of development.  The disadvantage is it is difficult for third parties to interface to your control (they are highly vulnerable to version changes).

0
 

Author Comment

by:anilkumarv
ID: 1178528
Thanx,
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Where to obtain Oracle Data Provider for .NET 3.5 7 53
What is MicroStrategy.NET? 2 66
Safe conversion? 4 67
VS2015 Redefinition errors 4 49
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
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…

776 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