Solved

Activex Controls

Posted on 1998-11-23
2
201 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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
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.

821 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