VC++ notes by umairsheikh2002

VIEWS: 3,485 PAGES: 25

More Info
									CONCISED NOTES VC++ Chapter # 09
Microsoft Foundation Classes: (MFC):
Microsoft Foundation Classes provides a large collection of prewritten classes, as well as supporting code, which can handle many standard windows programming tasks, such as creating windows and processing messages. The MFC can simplify your GUI programs and make your programming job considerably easier. The MFC functions internally call Win32 API functions. You can write windows GUI programs in C++ using both the MFC and the Microsoft Wizards. You can use AppWizard to generate the basic source files for a variety of different types of GUI programs. MFC GUI programs generate using Application Wizard four main classes. The SDI Application derived four classes.     Document Class View Class Main Frame Window Class Application Class (CDocument) (CView) (CFrameWnd) (CWinApp)

1: Document Class:
The Document Class is simply storing the program data, variables as well as for saving data from disk or editing it. This class is derived from the MFC class CDocument.

2: View Class:
The View Class manages the view window. This class is responsible for processing user input and user instructions and displaying the documents within the view window and on the other output or viewing devices. This class is derived from the MFC class CView.

3: Main Frame Window Class:
The Main Frame Window Class is used to manage or to control the main program window. This frame window displays user interface objects such as a window frame, a menu, a title bar, a scroll bar, minimize or maximize button, and close or restore boxes and toolbar or a status bar. It is located in the blank area inside these objects. This class is derived from the MFC class CFrameWnd.

4: Application Class:
The Application Class is used to manages the application and perform simply the general tasks as initializing the application and doing the final application clean up. This class is derived from the MFC class CWinApp.

SDI: Single Document Interface. Initial point of progeam is main like win main.
Wizard: CProjApp  CProjDoc  CProjView  CMainFrame  MFC CWinApp CDocument CView CFrameWnd     Files Application(.h, .cpp) Document View for Display Main Windows

Header Files: (.h):
Have a signature or definition of a prototyping.

Code, logic, function, implementation.





In VC++ we use plateform MFC. It is an approach; through this approach you use windows application or program. MFC encapsulates API’s. MFC application wizard provide basic wizard of program ot the architecture of application. Two types of MFC. 1. GUI 2. Non GUI CWind is the based class; you can use it through child class or functions. CWind is the base class of GUI but in NON GUI, it has not only one base class. There are 3 kinds or types of applications.

1. Single Document Interface Application (SDI). 2. Multiple Document Interface Application (MDI). 3. Dialog Based Interface Application (DBI).

Chapter # 19
Device Context:
A device context is a window object. Device Context is a logical object or a structure, which is used in displaying data, either it is text or graphics. It provides you device dependencies. When you drawing graphics, the device context object stores the drawing tools you have selected and the attributes you have set, and provide you a collection of member functions for drawing like lines, rectangles, ellipse, square etc. The Device Context kept three drawing objects by default.  Pen  Brush  Font There are some other Drawing Objects, like bitmap, region, palette etc. but these three are the basic type of drawing objects. Basically the Drawing Object is used to control the attributes of drawing. The MFC provide you a class for Device Context, which is known as CDC. The CDC can give us a function of DC, like drawing, color scheme, display color etc. The attributes of output device held on DC. MFC can provide some classes of these drawing objects. The classes are as follows:  CPen  CBrush  CFont

Steps in DC:
Go to ondraw function Whenever you window refresh, so your ondaw function called. On the backend, there is a message come.

The current pen affects the way that lines are drawn; it affects straight or curved lines (eg. using the LineTo or an Arc function) as well as the border drawn around the closed figures (like Rectangles, RoundRect, Ellipse etc). The default pen draws a solid black line that has a width of 1 pixel. To change the default color of pen, you can select a stock pen or a custom pen and then select it into the device context object. Once you select a particular pen, it will be used in the drawing of all subsequent graphics, until you explicitly select a different pen.


The current brush affects the way that the interiors of closed figures are drawn or in other words that it is used to fill the inner portion of the closed figures like Rectangle, Ellipse etc. the default brush fills the interior of closed figures with solid white. The interior To change the default color of brush, you can select a stock brush or a custom brush and then select it into the Device Context object. Once you select a particular brush, and then fill your particular rounded area.

The current font provide you the Font Style, Font Size, and Font Color. By default the current font is Black. We can display our font by using the TextOut. We can change the default font by selecting a Font Style (like Arial, Time New Roman, Arial Black, Arial Narrow, Book Antiqua etc).

Implementation of CPen:
Example with single Pen: CPen MyPen; MyPen.CreatePen(2,3,RGB(255,0,0)); pDC->SelectObject(&MyPen); pDC->Ellipse(10,10,100,100); Example with Two Pen: CPen MyPen,*POld; MyPen.CreatePen(2,3,RGB(255,0,0)); POld=pDC->SelectObject(&MyPen); pDC->Ellipse(10,10,100,100); pDC->SelectObject(POld); pDC->Rectangle(10,10,50,50);

Implementation of CBrush:
Example with single Brush: CBrush MyBrush; MyBrush.CreateSolidBrush(RGB(0,255,0)); pDC->SelectObject(&MyBrush); pDC->Ellipse(10,10,100,100); Example with Two Brush: CBrush MyBrush,*POld; MyBrush.CreateSolidBrush(RGB(0,255,0)); POld=pDC->SelectObject(&MyBrush); pDC->Ellipse(10,10,100,100); pDC->SelectObject(POld); pDC->Rectangle(10,10,50,50);

Implementation of CFont Class:
CClientDC dc(this); CFont MyFont; MyFont.CreateFont(40,0,0,5,800,0,0,0,ANSI_CHARSET, OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,DEFAULT_PITCHFF_DONTCARE, “Georgia”); SelectObject(&MyFont); dc.TextOut(200,100,Muhammad Touqeer):

Fonts in MFC
Fonts are GDI objects. The same rules about selecting them into device contexts apply:  There is always exactly one font selected.  There is a default font selected to begin with.  You can create and destroy fonts without needing a device context.  It’s an error to destroy a font while it is selected, so when you select a font, you save a pointer to the old font so you can select it back later.

Code (Pen):
MessageBox(“Preston”); pDCEllipse(10,10,100,100);

Code (Brush):

Code (Font):

How to select objectrs in DC:
1. 2. 3. 4. Create Drawing Objects Initialize Drawing Objects Select Drawing Objects in DC Drawing

Chapter # 10
App P P B F Doc P B F dc DC View MFra B F

Messages: are of two types:
1) Windows messages:
Windows messages are the integer values, whenever an event occurs, operating system send values to the application.

2) Command messages:
Command messages are basically the menu items or the tool bars, through which we can control our execution. Functions that are execute command messages are called command message handlers. Visual Studio provides us a tool known as Resource Editor. The MFC provides special handlinf for messages generated by user interface objects. These objecrs are standard interface elements that are supported by MFC. They include menu commands, toolbars, dialo boxes etc. The message generated by user interface objects are called command messages.

Message handler:

Message handler is a function, which can connect or handle the particular function.

Message mapping:
Message mapping is used to connect a message with a message handler. It is a MFC features. MFC provides Macros for message mapping. Visual Studio provide a tool for message mapping named as class wizard.

You use or design your data or document in SDI, so if you wants to view it, but it is not possible to create an objects and call these document on view class. So view class gave you a function Get Document(), which can return pointer of the Document. Through which you can view the document file or your data.

Is used to manipulate the point structure. It is derived from tag point class, this means that the data members of point structure x and y are accessible. Object can be used wherever a point structure is used.

Is an MFC class that provides member functions for initializing menu commands (as well as other user interface objects). The code you added calls the CcmdUI member function enable the Delete All menu command if the document contains at least one line, or disable the command if the document contains no lines. It provides 4-member function that you use to initialize the menu command. 1. Enable 2. SetCheck 3. SetRadio 4. SetText

Mini Draw:
The mini draw allows you to draw straight lines within the view window. To draw a line yu place the mouse cursor at one end of the line, press the left button, drag the cursor to the other end of the line and release and replace the button.

Steps of Windows Messages:

CDC have only one constructor, like CClientDC or it is a deribed class of CDC. To select it: Steps  Select or go to class wizard  Select object  ID’s  View  Messages (Virtual Function)  WM for Windows Messages, select WM_LButtonDown  Go to Member function  Go to class  Cview  WM_LButtonDown  Double Click and write code

On WM_LButtonDown { CClientDC dc(this); dc.Ellipse(10,10,100,100); } On WM_LButtonDown { CClientDC dc(this); dc.Rectangle(point.X-100,point.Y-100,point.X+100,point.Y+100); }

Steps of Command Messages:
afx_msg on f1(); afx_msg on f2(); Steps:    

Go on View.CPP Begin_Message_MAP() ON_COMMAND(ID_CIRCLE.onf1); END_MESSAGE_MAP()

Begin or End both are Macros, it provide Connectivity, or these are command message handlers.

We make a circle whose ID is ID_CIRCLE have generate two messages 1.  COMMAND ONCIRCLE();


1: we can add the class wizard, we can mapped or mapping on lnly fuction that derived C_COMMAND target class. Select an ID D_Drag Add both  OK Go to the View Class

Write Code MessageBox(“Preston”); 2: when your user interface object refresh, so 2nd function UPDATE_COMMAND_UI calls. It can hide or open your objects or buttons.

Code on UPDATE:
MessageBox(“Preston”); Select or add another button Go on View Class Right Click Add Variable. BOOL m_bFlag; Write after constructor m_bFlag=TRUE;

Code on OnDrag:
If (m_bFlag) m_bFlag=FALSE; else m_bFlag=TRUE;

Code on UPDATE:
If (m_bFlag) pCmdUIEnable(0); else pCmdUIEnable(1);

Add Variable CString m_Var Go on constructor m_Var=“m”; Go on View OnDraw Function

pDC TextOut(10,10,GetDocument()  m_Var);

Chapter # 15
Dialog Boxes:
 It is a windows user interface object or special windows object.  It is used to prompt a message.  To provide user interactive for I/O.  To design it, we use control. By user interface view, we divide it into two parts. 1) Custom Dialog Box 2) Common Dialog Box

Custom Dialog Box:
Custom dialog box are those, which user designed this for their own needs or requirements.

MFC provide us a CDialog class for the Custom Dialog Boxes. CDialog is the base class, it have different classes. This can support user or custom Dialog Box. This is not show only fix pattern.

With the help of CDialog, we can design Custom Dialog Box. We don’t derive it without CDialog, because we do not use features of CWind.  Design  Create class  Use object in application

Go on resource editoe Right click on Dialog Box  insert Dialog There is a dialog box editor open in which you edit something. Edit button OK Cancel

IDOK and IDCancel is Predefined values. Its function is destroy. If you write other values so your Dialog Box is not destroy. Add Handler: On view class  insert WM_LButtonDown Write code on View Class Uctouqeer MyDlg; MyDlg.DoModal(); Go on top #include “uctouqeer.h” With the help of variable, you can communicate user between Dialog Box (user create Dialog Box). Go on Class Wizard Go on Member Variable Select uctouqeer Double click on 5(name) m_sName Go on handler Write a code MyDlg.m_sName= “Pimsat”; Or if (MyDlg.DoModal()==IDOK); { MessageBox(MyDlg.m_sName); } Add three (3) variables on Dialog Box Subject 1 Subject 2 Subject 3

Edit 1 Edit 2 Edit 3
Total OK Cancel

Go on class wizard Go on uctouqeer Select ID_Equal Add function BN_Clicked On ID_Equal: Write code UpdateData(TRUE); m_Total=m_sub1+m_sub2+m_sub3; UpdateData(FALSE);

Add Variables: m_Sub1 m_Sub2 m_Sub3 m_Total

Common Dialog Box:
Common dialog box are those, which is frequently used for standard by windows. Examples are Open, Save, Save As, etc.

is an Abstract class. It have some sub or derived classes. Like (CFileDialog for File Open or Save, CColorDialog for Color, CFontDialog for font and CPagesetDialog for page setup).

CColorDialog: CColorDialog MyColorDlg; MyColorDlg.DoModal(); If (MyColorDlg.DoModal()==IDOK); { }

Another code:
{ CClientDC dc(this); CPen MyPen; MyPen.CreatePen(1,2,MyColorDlg.GetColor); dc.SelectObject(&MyPen); dc.Ellipse(5,5,101,101); } By execution point of view, we divide Dialog Box into two parts. 1) Model 2) Modless

In model, you cannot access other window of the same application. Eg: file open, file save etc.


In modless, you can also access other window or application.

Either you can make custom or common Dialog Box, so you use function DoModel. DoModel is a Virtual Function, which access the same name, but call every objects and perform differently with different objects or control multiple pointers. DoModel displays your function or wait until it is terminate. Control hold on Dialog Box.

Dialog Based Application:
App App




Go on New In Dialog Based  Next  Next  OK You can make clock, meia player, timer, chat software, etc In Dialog Box, there is a client area We want to Draw on Dialog Object, so we want to or need the DC. Go on Dialog Class, so before if code, Write code CClientDC dc(this); dc.Ellipse(10,10,100,100); x=ycosQ y=rsinQ Some hints for making calculator: CString m_Operand1(); m_Operand2(); CString m_EditBox; On f1(); { m_editBox+= “1”; UpdateData(TRUE);


on +(); { m_operand1()=m_editBox; }

App P B F Serialization MFra Cust/Comm Dial Box CClientDC View DC File Arc Arc Doc

Serialization is a process in which to make data persistence, (just like filing in C). MFC mechanism provides a convenient way to read and write a document from and to a disk file in response ro commands on rhe File menu. The serialize function can read or write the data member that is a fundamental type by using the overloaded << and >> operators with the CArchive object. MFC provide a class CFile, CArchive for serialization. Serialization is a process of writing or reading an object to or from a persistent storage medium such as a disk file. MFC supplies built-in support for serialization in the class CObject. Thus, all classes derived from Cobject can take advantage of Cobject’s serialization protocol. The basic idea of serialization is that an object should be able to write its current state, usually indicated by the value of its member variables, to persistent storage. Serialization handles all the details of object pointers and circular references to objects that are used when you serialize an object. A key point is that the object itself is responsible for reading and writing its own state. Thus, for a class to be serializable, it must implement the basic serialization operations. MFC uses an object of the CArchive class as an intermediary between the object to be serialized and the storage medium. This object is always associated with a CFile object, from which it obtains the necessary information for serialization, including the file

name and whether the requested operation is a read or write. The object that performs a serialization operation can use the CArchive object without regard to the nature of the storage medium. A CArchive object uses overloaded insertion (<<) and extraction (>>) operators to perform writing and reading operations.

In which we perform filing, to save the data. It’s purpose is only filing. In filing we can store data, read, write, close, managed the data. File object direct communicate with memory. It works both read and writes. CFile is the base class for Microsoft Foundation Classes. It directly provides unbuffered, binary disk input/output services, and it indirectly supports text files and memory files through its derived classes. CFile works in conjunction with the CArchive class to support serialization of MFC objects. The hierarchical relationship between this class and its derived classes allows your program to operate on all file objects through the polymorphic CFile interface. A memory file, for example, behaves like a disk file. Use CFile and its derived classes foe general-purpose disk I/O. use Of-Stream or other Microsoft IO-Stream classes for formatted text sent to a disk file. Normally, a disk file is opened automatically on CFile construction and closed n destruction. Static member functions permit you to interrogate a file’s status without opening the file.

CArchive is that object where data is hold or a place where data is save. It is used to provide buffering support or file accessing. It is direct in memory or go through file. Archive object work on two parts. So this process is called back purposes or serialization. CArchive object is attached to the open file, and it provides a set of member functions that allows you to easily read data from this file, or write data to it. The CArchive member function IsStoring returns TRUE if file has been opened for writing and IsStoring returns FALSE if the file has been opened for reading. The CArchive class allows you to save a complex network of objects in a permanent binary form, usually disk storage that persists after those objects are deleted. You can load the objects from persistent storage, reconstituting them in memory. Think of an archive object as a kind of binary stream. Like an input/output stream, an archive is associated with a file and permits the buffer writing and reading of data to and from storage. An input/output stream processes sequences of ASCII characters, but an archive processes binary object data in an efficient, nonredundant format. When you construct a CArchive object, you attach it to an object of class CFile, or a derived class, that represents an open file. You also specify whether the archive is used for loading or storing. A CArchive object can process primitive types, as will as objects of CObject derived classes designed foe serialization.


Object means properties, so object save the signatures. If you want to serialize for any object so that object must be derived from CObject.

Add 3 variables, (on add member variable) On document class After document constructor(Key) Write a code m_sName= “ ”; m_iRegNo=0; m_fPercentage=0.0f; MFC gave you a class templates for store your objects dynamic data. Draw a Dialog Box 3 Edit or 3 Static Boxes one OK, and one Cancel. Add Class touqeer Add Variable set it, on touqeer Add Handler on View

Code on View Handler:
touqeer MyDlg; MyDlg.Name=GetDocument()m_sName; MyDlg.RegNo=GetDocument()m_iRegNo; MyDlg.Percentage=GetDocument()m_fPercentage; If (MyDlg.DoModal()==IDOK); { GetDocument()m_sName=MyDlg.Name; GetDocument()m_iRegNo=MyDlg.RegNo; GetDocument()m_fPercentage=MyDlg.Percentage; }

To Start Serialization:
Go on Document Class Go on Serialize Function Archive Object check it is read or write. TRUE means Write or FALSE means Read.

Code for Write:
ar<<m_sName; ar<<m_iRegNo; ar<<m_fPercentage;

Code for Read:
ar>>m_sName; ar>>m_iRegNo; ar>>m_fPercentage;

f_Save Dlg:
1. 2. 3. 4. To return file name File Object Archive Object Serialize (ar).

Chapter #
Bitmap Handling:
     It hold information in form of pixels. It can hold information of every pixel. It is an Array of pixels. Its purpose is to store, handle or save complex images. It is drawing object.

MFC provide us a class for Bitmap is CBtmap or gave some CDC functions for bitmap handling. There are two types of bitmap with respect to loading. 1. Resource Bitmap 2. Runtime Bitmap Those painting which already exist before runtime is called Resource Bitmap or Static Bitmap. Those painting which can run at the time of tunning is called Runtime Bitmap. Bitmap provide us a fast accessing for drawing any objects.

Resource Bitmap: Code:
     SDI Resource Editor Right Click  Insert Bitmap  New Paint it any Rectangle. Step # 1 Load Bitmap Object MemDC Step # 2

Compatible Step # 3 DC

Step # 4 Copy Bitmap View

Mem DC is made in memory which don’t link with view. It can compatable(link) with DC.

Code: (OnDraw): Draw or make object Step # 1 CBitmap MyBitmap; MyBitmap.LoadBitmap(ID_….); Step # 2 CDC MemDC; MemDC.CreateCompatibleDC(pDC); Step # 3 MemDC.SelectObject(&MyBitmap); To copy data there are 3 functions which CDC provide this; CDC :: BitBlt (as it is copy) CDC :: StretchBlt (you stretch or change) CDC :: PathBlt Step # 4 { pDC BitBlt(0,0,100,100,&MemDC,0,0,SRCCOPY); } Where BitBlt(x, y, Bitmap width, Bitmap height, & Source DC, x,y,SRCCOPY or Raster Operation). Where X and Y is a Destination Point, where you place your bitmap Second X and Y are the Source DC point.

for(short i=0; i<200; i++); { pDC BitBlt(I,I,100,100,&MemDC,0,0,SRCCOPY or SRCINVERT); } Source Copy or Source Invert perform a Raster Operation. Raster Operation set a drawing mode. How to combine drawing or DC objects.

Examples are Pen, Brush, or DC. To set Pen or Brush set it set ROP2. 3rd function is PatBlt. These Pat means Pattern. So BitBlt, StretchBlt, and PatBlt are 3 functions of Bitmap and perform Bit Operations.

StretchBlt: Code:
Protected: CBitmap MyBitmap; Int MyBitmapHeight; Int MyBitmapWidth; Bitmap BM; MyBitmap.loadBitmap(IDB_BITMAP1); MyBitmap.GetOBject(size of (BM), &bM); MyBitmapWidth=BM.bmWidth; MyBitmapHeight=BM.bmHeight; CDC MemDC; RECT ClientRect; MemDC.CreateCompatible(NULL); MemDC.SelectObject(&myBitmap); GetClientRect(& ClientRect); pDC StretchBlt(0,0,CClientRect.height,CClientRect.Bottom,&MemDC,0,0,MyBitmapWidth. MyBitmapHeight,SRCCOPY);

MDI Application:
 Add ToolBar/StatusBar  Multi Threading Read Program Execution Sequence or WinMain (which can start your computer) on chapter # 09. App

Single Document Template




Document Template:
Which represents or which used to link some objects. MFC provide a class for Document Template called or known as CDocTemplate. It is an abstract class. CSingleDocTemplate or CMultiDocTemplate is a derived classes. CDocTemplate itself not object, because it is an absteract class. So it can create some classes or have some classes. It can manage the objects. In CSingleDocTemplate, we can use direct features, or gave a pointer. In CMultiDocTemplate, there is a Multidocument. So in MDI, there is a MultiDocuments, MultiViews, multiple application but have a Mainfeame. Mainframe is only one, but consists of the number of Child Frames. So each Child Frame link with View.


Multiple Document Template



Doc Doc Doc

Child Child Child Child


View View View

In MDI, it can support Multiple Documents, but not Multiple Fotmats. But in MFC, it is also possible or MFC provide Multiple Formats, read later.

Add ToolBar/StatusBar:
 Design  Call (create object, its object create/initialize/display). MFC provide us CToolBar for adding ToolBar or StatusBar.

Resource Right Click  Insert Resource  ToolBar Draw Something. We can Initialize in MainFrame. OnCreate Function = when MainFrame create so the function is call. When MainFrame creates so ToolBar also create, that’s why we code it into MainFrame.

Code: (MainFrame Class):
CToolBar MyToolBar;

OnCreate: { MyToolBar.CreateEx(this,TBSTYLE_FLAT,WS_VISIBLE:WS_CHILD: CBRS_ALIGN_TOP:CBRS_GRIPER); MyToolBar.LoadToolBar(IDR_TOOLBAR1); } Add StatusBar so Read it in Chapter # 16 or 17. Function/Class Templates: In C++ or other, we can use different functions, like int or float. We can not use a single function for all, so how to overcome this, so we can use a Templates. Job have same, but multiple functions, so it can complex our data. That’s why C++ provide us a concept of Templates. Class f1(Class X, ClassY) Class is a reserve word of C++. It accept all factors like int, float etc. so it is templates. Compiler make the copy of different cdata types, before running means on time of compilation, so it is easy to handle or simplicity. CBall b[15];  static array, execution fast in array, but draw abck is that only one type of data type used so we make it dynamic to handle that cause, it is difficult.

Dynamic Array is slow, with the help of class templates we can implement dynamic
array or support different types of arrays.

CTemplateArr Temp;
An advantage of templates is to store it in different data types objects. It may be dynamic.

How to implement: How to create Dynamic Array:
Chapter no. 7, 8,9, read Class Templates/Functions templates.

DLL stands for Dynamic Link Library. In which code is existing. COM stands for Component Object Modeling. Class reasibility, drawback is use only on one class so class is a language dependencies. While using Com, we use it in different classes. To share their ideas to integrate it, which is language independent, depand on binary code, so this facility provides only COM objects. COM is an object like a class. It provide interface. Classes formats Is language dependent in which COM format is generally in binary form. COM implement on VC, VB, etc.

Advanced of COM, COM is based on this, only difference between this is that

Attributes Event Methods

Attributes Function Pocedures

ADO stands for ActiveX Data Objects, is used for user interface form. CDAO is a class for connectivity. Threads is a windows features. Bitmap is a windows features. Server Engine ADO User Interface Form

Utilize the idele time of processor. Your Application is a Main Process while your Thread is a Mini Process. You implement the thread is called secondary thread or your original Application thread is primary thread. MFC provide us a support for Threading like CWinThread. You can handle or managed or control the thread. The duration of each thread is equal. There is a global function “BeginThread” of CWinThread, to start a thread. Thread Function is Global. You can write the function by this. It is an operating system features, so you are restricted or wite it as Thread Function. Thread Function: UINT ThreadfxName(LPVOID pVoid) { return 0; } LongPointer is a pointer, it is 32 bits values, data tpe is not specific, it is not a typed specifier, you pass all 32 bits for any pointer values. LP is a windows feature.

Create SDI Application:
Go on view class Go on header files before class definition you write a code UINT MyThread1(LPVOID pVoid); Go on implementation of view class or Go on onPaint or OnDraw UINT MyThread(LPVOID pVoid); { return 0; }

Go on CPP top CClientDC *MyClientDC; Go on OnPaint(OnDraw): PMyClientDC=new CClientDC(this); We can new it because it access to through out, it is save when you not delete it.


Add Handler:
Write code on handler L_MouseButtonDown Afx BeginThread(MyThread1,this); Loop for and coding

How to manage MultiThreading:
Synchronization means sorting, order or manner ways. Windows gae an objects to synchronization for your threads. Some algorithms or philosophies are as follows Event Semaphore Critical Section In all these one set the priority other restrict the thread.

Visual Studio and MFC Application Wizard?
Features: 1. fast skeleton, add on Application. 2. generate comments. 3. generate separate files of class. 4. Easy to Handle, because we not write a code.

Some Important Questions By Exams point of view
Two Category: One is C++ Second is VC++ Q#1) SDI and MDI. Q#2) Dialog Based Application. Q#3) Dialog Boxes either Custom or Common. Q#4) Serialization and with MFC supports. Q#5) Add Tool Bar, Status Bar, how to add toolbar. Q#6) Dvice Context, Message Mapping. Q#7) Btmaps. Q#8) MultiThreading. Q#9) OLE.

Q#10) VS or MFC Application Wizard. Q#11) Class, Objects, Inheritance, Polymorphism, Encapsulation, etc. Q#12) Function/Class Templates.

The End

To top