Monday, April 1, 2013

mfc program TO DRAW A TEXT IN THE WINDOW

              /*TO DRAW A TEXT IN THE WINDOW*/


#include<afxwin.h>
class myframe:public CFrameWnd
{
public:
    myframe()
    {
        Create(0,"HELLO");
    }

    void OnPaint()
    {
        CPaintDC dc(this);
        dc.TextOut(350,250,"WELCOME");
    }                                                                                           
                                                                                        
    DECLARE_MESSAGE_MAP()
};

BEGIN_MESSAGE_MAP(myframe,CFrameWnd)
ON_WM_PAINT()
END_MESSAGE_MAP()

class myapp:public CWinApp
{
    virtual BOOL InitInstance()
    {
        m_pMainWnd=new myframe;                              
        m_pMainWnd->ShowWindow(1);
        m_pMainWnd->UpdateWindow();
        return TRUE;
    }
};
myapp app;


Asvantages of using MFC libraries..

MFC is the easiest way for you to achieve two kinds of portability:
  • Portability among different operating systems
  • Portability among different processors
MFC is designed to wrap your C/C++ applications to work on almost any operating system with little or no modification, including 32-bit Windows and UNIX if a UNIX MFC library is present. MFC is also designed to be completely portable among different processors.

No comments:

Post a Comment