Solved

Activex Controls

Posted on 1998-11-23
2
194 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
Comment Utility
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
Comment Utility
Thanx,
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

762 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now