C#
  Home arrow C# arrow Page 3 - An Overview of MFC, Part 1
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Moblin 
JMSL Numerical Library 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
C#

An Overview of MFC, Part 1
By: Digvijay Chauhan
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 11
    2005-02-15

    Table of Contents:
  • An Overview of MFC, Part 1
  • Getting Started with MFC
  • What is MFC anyway?
  • Using the Windows Event Driven Model
  • Building our First Application

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    An Overview of MFC, Part 1 - What is MFC anyway?


    (Page 3 of 5 )

    So let’s talk about MFC. Why do we need MFC when we can create a full fledged Windows application using the Windows API? One reason is that, when doing the latter,  you have to write a lot of boilerplate code. Another reason is that, once your code exceeds a few thousand lines, it is difficult if not impossible to manage.

    The focus of developing applications is to fulfill client needs in most cases -- and you have to develop them without asking a lot of questions if the client is a non-techie guy. So both of you have a very different perspective about the same problem. Say you need to write a program that allows fast searching and viewing of very large image files on a number of disks that also lets the user edit them. "Where do I begin?" is the first question that comes to your mind.

    Yes, it is quite a pain to isolate the application logic from the code that you use to make the application, but with MFC you have a solution. Using Object-oriented programming concepts that wrap up the Windows API in a well defined manner makes this possible. Imagine one class that wraps up the User Interface of your application and another that encapsulates the processing logic of your application. Now you can be sure what goes where. This is much simpler than the structured way. We shall shortly see this in action!

    Another advantage is that if you have the User Interface separated from logic, you can play with the user interface elements without affecting the application logic as you do in Visual Basic. But you may have this capability with the raw power of C++ using the MFC classes that encapsulate almost all of the Windows API.

    The MFC library that comes straight from Microsoft is essentially a C++ class library that wraps most of the raw Windows APIs to let us write programs in a better, managed way. The biggest benefit that we get by using this library is efficiency. It greatly reduces the amount of code that must be written to create a Windows program. It also allows us to design our solutions using object oriented methodologies and some other features that come bundled with C++ like RTTI.

    As we discussed earlier, the code we write using MFC is portable. By this I mean that code written under Windows 3.1 can be moved to Windows NT or Windows 95 very easily, perhaps just with a recompile, but I don’t believe that it is done nowadays. Anyway, now we can surely conclude that MFC is a preferred way for developing Windows applications.

    From a developer's point of view, it lets you capture the client's requirements and design an appropriate User Interface. If you find that it does not have a user interface (as in the case of a Windows service), you can still use MFC to write code or use the Dialog Editor to create the designed user interface and other controls (like menus, buttons, toolbars, and so forth) and customize their appearance. You then begin with writing code that responds to user interactions with these controls. For example, if the user clicks a menu item, you might want to load a large image file. In this way you essentially are writing event handlers that will form the logic of any application. Once the application behaves properly to all possible user requests, you may begin with testing and deployment.

    From the above discussion you’ll find that the creation of a Windows program is a very simple process when we code using MFC.

    More C# Articles
    More By Digvijay Chauhan


       · Hi I'm Digvijay ....... the author of this article.Please feel free to ask any...
       · This article should be filed under C++ and not under C#Regards,Anand...
     

    C# ARTICLES

    - Working with Regular Expressions in C#
    - Sending Simple E-Mail in C#
    - Building C# Comparable Objects: IComparable ...
    - Color Transformation Applications in C# GDI+...
    - Performing Color Transformation Operations i...
    - Color Transformation in C# GDI+ Programming
    - Exceptions in C#
    - Overriding versus Overloading
    - Value Types and Reference Types
    - Defining Member and Type Visibility
    - Managing Files in C#
    - Working with Windows Registry in C#
    - Lossless Image Resizing in C#
    - Lossless Image Converting in C#
    - Creating an RSS Feed with ASP.Net Written in...





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway