D-event Oriented Window Programming :->
Windows programs are event driven. This means that such programs respond to user actions called events. Such as clicking the mouse striking a key and so on.
Each time such an event occurs, the corresponding method is called in our program. Such a method is known as Event Handler. In this way, the whole program is broken up into bite sized methods responding to various windows events.
For example :- The OnDraw() method handles the case in which the client area. The Onchar() method handles the case the user presses a key on the keyboard.
The LButtonDown() method handles the case when the user clicks the left mouse button.
Method
i) OnLButtonDblclk :- called when the user double clicks left mouse button.
ii) OnLButtonDown :- called when the user presses the left mouse button.
Microsoft Foundation Class Liberaries (MFC)
Microsoft provides a library that makes the programmer's job easier called the Microsoft Foundation Class library(MFC). It is an extraordinary package of pre-written, ready to use code. It greatly reduces the amount of code that must be written to create to a windows program. For Example Instead of having to write all the code (and that's a huge amount of code) to support a new window. We can just rely the MFC Cwnd code package, which handles all the details for us.
It also provides all the advantages normally found in C++ programming. Such as inheritance and encapsulation. The visual C++ application development environment is specifically tuned to MFC, so by learning MFC and visual C++ together one can significantly increase its power as an application developer. The library's primary advantages is its efficiency.
Some of the basic MFC's are :->
1) CDC : This handles device context for viewing on screen or printer.
2) Cstring : This handles text string for us.
3) Cwnd : This handles window functioning.
4) CFile : This handles all the work related to file i.e opening, closing, writing etc.
5) CDialog : This handles all the work related to dialog box.
6) CButton : This handles work related to Button.
7) CPen : This handles drawing with pen in particular color.
8) CSlider : This handles slider work where value is taken from the user.
9) ChttpConnection : This executes HTTP requests.
10) CObject : This handles work related to serialization in file handling.
To develop a windows applications in VC++, we use MFC AppWizard. The AppWizard creates a great deal of code in our program for us. We just need to modify the code according to our requirement.
Post a Comment