BrainDump
  Home arrow BrainDump arrow Page 2 - Introduction to MFC
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  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
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? 
BRAINDUMP

Introduction to MFC
By: Gabor Bernat
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 5
    2008-02-27

    Table of Contents:
  • Introduction to MFC
  • Windows and Event Handling
  • The First MFC Program and the Basics
  • Explaining the File Names and Extending the Application
  • Conclusion

  • 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


    Introduction to MFC - Windows and Event Handling


    (Page 2 of 5 )

    If your to answer the question of how Windows manages to control all the applications at once is "event handling," then you are on the right path and surely deserve the gold medal. However, there is another good response: message cycles. Windows monitors all user activities like the mouse, keyboard, and so forth. When a message (event) occurs that affects one of the programs, a message is sent to it. For example, if you push down the left click, then Windows notifies the application by dispatching a WM_LBUTTONDOWN message towards it. You get the picture, right?

    Once this is completed, it is up to the software to decide what it should do with the received message. The decision is made in accordance with the message cycle in its interior. There are two options: first it may decide that an interior handling is necessary and call for the function assigned to take care of the respective message. Then the function executes all the code that we previously wrote in it.

    The second option is to ignore the message, as in the case of the absence of a function assigned to it. Either way, a result will be sent back to Windows and the OS can take the next step. It will take care of future trouble according its own message map.

    The power of MFC lies in the encapsulation of the message handling. An MFC application does the same thing that a Win32 (32-bit API for modern versions of Windows) application does. The distinction is that, while coding under Win32 demands its own message handling (and all the trouble that this implies), the developer under MFC doesn’t implicate itself in this; s/he can sit back and concentrate on pure code writing. All s/he needs to do is declare a message map through which informing the MFC system is possible, describing the way it should allocate the messages. The interior system of the MFC will take care of the rest.

    This is indeed a great step forward, but wait… it’s even simpler. And some truly powerful extra instruments were created under Visual Studio that tend to make programming under MFC effortless. These are the AppWizard (for creating a new application) and the Properties Window (in the case of Visual Studio prior to the .NET platform, it is known as the ClassWizard – for handling the message map).

    More BrainDump Articles
    More By Gabor Bernat


       · MFC is the article stated the tool of the lazy programmer who don't want to write a...
     

    BRAINDUMP ARTICLES

    - Introduction to Office Live Workspace
    - Using MS Excel for One-way Analysis of Varia...
    - Comparing Data Sets Using Statistical Analys...
    - Import Blogger Posts into WordPress Using Wi...
    - Download WordPress from an FTP Server and Ru...
    - Install and Run WordPress in XAMPP Local Host
    - What Windows 7 Brings to the Table
    - Virtualization and Sandbox Detection
    - Advanced Firebug Techniques in Windows XP Ho...
    - Editing CSS with Firebug in Windows XP Home
    - Using Firebug in Windows XP Home
    - Migrating to Exchange Server 2007
    - Using System Restore on a Non-Bootable PC
    - Finding Logged on Users and More Scripting S...
    - Developing Macro Commands in MS Excel





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek