zoukankan      html  css  js  c++  java
  • MFC BEGIN_MESSAGE_MAP()

    引用:http://www.cppblog.com/momoxiao/archive/2009/10/22/99206.html

    1BEGIN_MESSAGE_MAP(CpassApp, CWinApp)
    2    ON_COMMAND(ID_HELP, CWinApp::OnHelp)
    3END_MESSAGE_MAP()


    这些都是宏定义,不是函数。 
    在BEGIN_MESSAGE_MAP()和END_MESSAGE_MAP()之间添加你的消息响应函数,为每个消息处理函数加入一个入口



    BEGIN_MESSAGE_MAP( theClass, baseClass )

    参数:

    theClass 指定消息映射所属的类的名字。
    baseClass 指定theClass的基类的名字。


    说明:
    使用BEGIN_MESSAGE_MAP宏开始你的消息映射的定义。
    在你的类的成员函数的实现文件(.CPP)中,使用BEGIN_MESSAGE_MAP宏开始消息映射,然后为每个消息处理函数加入一个入口,最后用END_MESSAGE_MAP宏结束消息映射。


    每个消息映射入口的格式如下:
      ON_Notification(id, memberFxn)
      其中id指定了发送通知的控件的子窗口的ID,而memberFxn指定了处理该通知的父对象中的成员函数名
      父对象的函数原型格式如下:
      afx_msg void memberFxn( );

      可能的消息映射入口如下:

    映射入口 何时向父对象发送消息
    ON_BN_CLICKED   用户单击按钮时
    ON_BN_DOUBLECLICKED 用户双击按钮时


    例如:

    1BEGIN_MESSAGE_MAP(CpassDlg, CDialog)
    2    ON_WM_SYSCOMMAND()
    3    ON_WM_PAINT()
    4    ON_WM_QUERYDRAGICON()
    5    //}}AFX_MSG_MAP
    6    ON_BN_CLICKED(IDOK, OnOK)
    7    ON_BN_CLICKED(IDCANCEL, OnExit)
    8END_MESSAGE_MAP()

    void CTestDlg::OnSysCommand(UINT nID, LPARAM lParam)

    这个函数响应系统控制菜单的命令.(即左上角图标处)。

    OnSysCommand:The framework calls this member function when the user selects a command from the Control menu, or when the user selects the Maximize or the Minimize button.

    另外:

    DoDataExchange:当UpdateData时候

    OnInitDialog:对话框类已经构造,但是对话框还没有显示出来的时候

    OnQueryDragIcon:The framework calls this member function by a minimized (iconic) window that does not have an icon defined for its class. The system makes this call to obtain the cursor to display while the user drags the minimized window

  • 相关阅读:
    火狐flash插件
    centos 安装php ide (eclipse + php 插件)
    编译器的工作过程
    php中调用mysql的存储过程和存储函数
    mysql 高性能
    存储过程/游标/mysql 函数
    php 生成二维码
    frameset,frame应用,常用于后台
    html5 meta头部设置
    CAReplicatorLayer复制Layer和动画, 实现神奇的效果
  • 原文地址:https://www.cnblogs.com/sode/p/2737547.html
Copyright © 2011-2022 走看看