Monday, April 1, 2013

visual c++(mfc)program for dealing with client area

visual c++(mfc) program for dealing with client area .
#include<afxwin.h>
class myframe:public CFrameWnd
{
public:
     myframe()
     {
       Create(0,"my mfc");
     }
     void OnLButtonDown()
     {
         MessageBox("clientarea",0,0);
     }
     void OnNcLButtonDown(UINT x,CPoint p)
     {
         CClientDC dc(this);
             switch(x)
         {
case HTMENU:MessageBox("MENU","my program");break;
case HTCAPTION:MessageBox("CAPTION","my program");break;
case HTCLOSE:MessageBox("CLOSE","my program");break;
case HTTOP:MessageBox("TOPBOUNDARY","my program");break;
case HTBOTTOM:MessageBox("BOTTOM BOUNDARY","my program");break;
case HTLEFT:MessageBox("LEFT BOUNDARY","my program");break;
case HTRIGHT:MessageBox("RIGHT BOUNDARY","my program");break;
case HTZOOM:MessageBox("MAXIMUM","my program");break;
case HTREDUCE:MessageBox("MINIMUM","my program");break;
case HTVSCROLL:MessageBox("VERTICAL SCROLL BAR","my program");break;
         }
     }

     DECLARE_MESSAGE_MAP()
};
BEGIN_MESSAGE_MAP(myframe,CFrameWnd)
ON_WM_LBUTTONDOWN()
ON_WM_NCLBUTTONDOWN()
END_MESSAGE_MAP()
class myapp:public CWinApp
{
public:
      virtual BOOL InitInstance()
      {
        m_pMainWnd=new myframe();
        m_pMainWnd->ShowWindow(1);
        m_pMainWnd->UpdateWindow();
        return TRUE;
      }
};
myapp app;

 As I understand it MFC are objects that consists of blocks of code that performs a particular function in a Windows environment. These objects enable the programmer to create Windows programs more speedily by using an existing library.

Examples of these functions are classes that enables the user to exit from a dialog by clicking on an exit button or selecting a particular option from a list.

M Visual C++ contains the full library of Microsoft classes and an environment in which to build programs, as you view its gradual development.


What is client area in vc++?

 It's the area inside a form, control or window without including any borders or frames around it.

 What is meaning of   window's client area?
 The client area is the inside area of window excluding the title bar, tool bars, status bar, scroll bars. For example in case of Internet Explorer the area in which the web pages are displayed.

No comments:

Post a Comment