Learning: Simple to use MFC to create a dialog window

MFC Description: Microsoft Foundation Class Library (English: Microsoft Foundation Classes, referred to as MFC) is a class library (class libraries) provided by Microsoft, the Windows API packages in the form of C ++ classes, and includes an application framework to reduce application the workload of application developers. Which contains a large package type and package type built Windows handle assembly and controls of many Windows.

Currently own understanding: Help us encapsulates WinMain, the message loop, the window procedure

1, create a simple MFC project, and open the current resource view Dialog

2, open the Toolbox to place a button, double-click the button, write the click event

void CMfcdemoDlg::OnBnClickedButton3()
{
    // TODO: 在此添加控件通知处理程序代码
    MessageBox(L"hello button");
}

3, the same can also add a click event for the current window

void CMfcdemoDlg::OnLButtonDown(UINT nFlags, CPoint point)
{
    // TODO: 在此添加消息处理程序代码和/或调用默认值
    MessageBox(L"hello current window");
    CDialogEx::OnLButtonDown(nFlags, point);
}

Guess you like

Origin www.cnblogs.com/zpchcbd/p/11975927.html