精华内容
下载资源
问答
  • Windows消息机制详解

    2018-10-15 09:40:00
    Windows消息机制详解 转载于:https://www.cnblogs.com/endenvor/p/9789345.html

    Windows消息机制详解

    转载于:https://www.cnblogs.com/endenvor/p/9789345.html

    展开全文
  • Windows 消息机制详解

    2010-12-31 11:24:32
    Windows 消息机制详解 zz from • http://www.360doc.com/content/10/0531/23/1131125_30579505.shtml 总的来说: MSG包括: 窗口句柄,指示MSG发送的目的窗口 消息标识 lPARAM、wParam 发送时间 发送时...

    Windows 消息机制详解

    zz from
    •    http://www.360doc.com/content/10/0531/23/1131125_30579505.shtml

    总的来说:
    MSG包括:
    窗口句柄,指示MSG发送的目的窗口
    消息标识
    lPARAM、wParam
    发送时间
    发送时的鼠标位置
     
    关于消息队列:
    Windows系统有一个系统消息队列
    每个线程都有一个自己的消 息队列(由于发送消息MSG需 要提供一个窗口HWnd,而基 本有窗口的线程,都是UI线 程),因此基本上如果线程使用了GDI函数,则windows给该线程分配一个线程消息队列,这个消息队列负责该线程的所有窗口的消息。
     
    所有的窗口都有自己的句柄(HWND),消息被发送时,这个句柄就已经被指定了。所以 当子窗口收到一个消息时,其父窗口不会也收到这个消息,除非子窗口手 动的转发。
     
    消息分为:
    实际上MSDN把消息分为队列型(Queued Message)和非队列型(Non-queued Message),这只是不同的路由方式, 但最终都会由消息处理函数来处理。
    队 列型消息包括硬件的输入(WM_KEY*等)、WM_TIMER消 息、WM_PAINT消息等;非队列型的一些例子有WM_SETFOCUS, WM_ACTIVE, WM_SETCURSOR等,它们被直接发送给处理函数。
    其实,按照MSDN的说法和消息的路由过程可以理 解为,Posted Message Queue里的消息是真正的队列型消 息,而通过SendMessage()发送到消息,即使它进入了Sent Message Queue,由于SendMessage要求的同步处理,这些消息也 应该算非队列型消息。也许,Windows系统会特殊处理,使消息强行绕 过队列。
     
     

    =====================

    一节详细描述消息和消息队列以及如何在 你程序中使用他们。
    关于消息和消息 队列
    与传统的应用程序不 同,Microsoft Windows应用程序并不显式地用一个函数的调用(如c运行库)来获取输入,而是,等待windows系统把输入传给它们。
    windows系统把应用程序 的所有输入传给应用程序的窗口,每个窗口都有一个称之为窗口过程的函数.当窗口有输入时windows系统要调用它,窗口过程处理输入并把控制返回 windows系统。有关窗口过程,参见 “窗口过程”。 这一章讲述消息及消息队列,并说明在应用程序中如何使用它们。
    消息
    windows系统以消息的形式把输入传给窗口过程,消息是由windows系 统或应用程序产生的.windows系统对每一个输入事件都要产生消息,例如,用户按键盘、移动鼠标或单击一个滚动条控制框。windows系统为了响应 应用程序给系统带来的变化也会产生消息,比如应用程序改变了系统字体资源池或是改变了一个窗门的大小。应用程序可通过产生消息指导它自己的窗口来完成某个 任务,或是与其它应用程序的窗口进行通信。
    windows 系统把消息发送给窗口过程.窗口过程有四个参数:窗口句柄、消息标识以及两个叫做消息参数的32位值。窗口句柄决定消息将发送到哪—个窗 口,windows系统则用它来确定向哪一个窗口过程发送消息。
    消息标识是一个命名的常量,由它来标明消息的目的。如果窗口过程接收到一条消息,它就通过消息标识来决定如何处理这条 消息。例如,消息标识WM_PAINT 通知窗口过程,窗口的客户区被改变了,需要重画。
    消息参数指定窗口过程在处理消息时所用的数据或数据的位 置,消息的意图及数值取决了消息本身。消息参数可以是一个整数、紧缩的位标志、一个含有附加数据结构的指针等等。如果消息不使用消息参数,一般就都设置成NULL 、 窗口过程必须检查消息标识以确定如何解释消息参数。
    消息路由
    windows系统用两种方式向窗口过程发送消息:把消息投递到一个先进先出的消息队列中,它是一个系统定义的内存块用于临时存储消息;或是把消 息直接发给窗口过程。
    投递到 消息队列中的消息叫排队消息,它们主要是用户通过鼠标或键盘的输入结果.如WM_MOUSEMOVE, WM_LBUTTONDOWN, WM_KEYDOWN, and WM_CHAR 消息。其它的排队消息包括定时器、绘制和退出消息:WM_TIMER, WM_PAINT, and WM_QUIT 。所有直接发送到窗口过程的其它消息称之为非排队消息。
    排队消息
    windows系统在同一时间可显示多个窗口,要发送鼠标和键盘输入到相应 的窗口,windows系统要用到消息队列,它要管理一个系统消息队列和任意数目线程消息队列,每一个队列对应于一个线程。
    不管什么时候,只要用户移动鼠标或是敲键盘.鼠标或键盘的 设备驱动器都要把输入转换成消息,并把它们放到系统消息队列中去。windows从系统队列中每次移走一条消息,确定目的窗口,再把它们投递到创建目的窗 口的线程的消息队列中,线程消息队列接收所有由该线程创建的窗口的鼠标和键盘消息。线程从它的队列中移走消息并指导windows系统将它们发送到相应的 窗口过程进行处理。有关线程,参见 “进程和线程”。
    WM_PAINT 消息有点特别,windows系统总是把这条消息放在消息队列的最后,这样 可保证窗口按先进先出次序接收它的输入消息,WM_PAINT 消息被保持在队列中,只有在队列中没有其它消息时才发送 到窗口过程。同一个窗口的多个WM_PAINT 消息被合并成一个WM_PAINT 消 息,把客户区所有无效部分合并成一个区域.合并WM_PAINT 消息节约了窗口必须重画客户区内容的时间。
    系统向线程消息队列投递消息是通过填充 一个MSG 结构,再把它复制到消息队列中,MSG 结构中的信息包括接收消息的窗口 句柄、消息标识、两个消息参数、消息时间以及鼠标的位置,线程可把消息投递到它自己的消息队列中或是通过函数 PostMessage 和PostThreadMessage 把 消息投递到其它线程的队列中去。
    应 用程序可通过函数GetMessage 从它的队列中移走一条消息,应用程序还可用函数PeekMessage 来 检查队列中的某个消息但并不移走它,这个函数用有关这条消息的信息填充MSG 结构。
    把一条消息从它的队列中移走后.应用程序可用函数DispatchMessage 指 导windows系统把这条消息发送到窗口过程进行处理。DispatchMessage 利用前面调用函数GetMessage 或PeekMessage 时 填充的MSG 结构的指针,把窗口句柄、消息标识及两个消息参数传给窗口过程,但它并不传送时间或鼠标光标的位置.应用 程序可以在处理一条消息时,通过调用函数GetMessageTime 和GetMessagePos 来 获取这些信息。
    一个线程可以 用函数WaitMessage 当他没有其他消息在其队列里时,产生对其他线程的控制。此函数将终止线程,直到一个新消 息被放入该线程的消息队列里,然后返回。
    你 可以调用函数SetMessageExtraInfo 来设置当前线程消息队列的附加信息。是和当前线程的消息队列联系 的32位值。用户可以用函数GetMessageExtraInfo 来获得附加信息,该信息将会保留到下次调用函数GetMessage 或PeekMessage 之 前。
    非排队消息
    非 排队消息是直接发送到目标窗口过程的,而不通过系统消息队列和线程消息队列。windows系统一般通过发送非排队消息把影响某窗口的事件通知窗口。例 如,如果用户激活一个新的应用程序窗口.windows系统就会向该窗口发送一系列的消息,包括:WM_ACTIVATE ,WM_SETFOCUS 和WM_SETCURSOR ,这些消息分别通知窗口: 它被激活了;将通过这个窗口进行键盘输入;鼠标已移到这个窗口边 框的里面了 。非排队消息也有可能发生在 应用程序调用一个windows系统函数时,例如,在应用程序用函数SetWindowPos 来移动一个窗口之 后,windows系统发送一条WM_WINDOWPOSCHANGED 消息。
    应用程序是调用函数SendMessage 、SendNotifyMessage 或SendDlgItemMessage 发 送消息的。
    消息处理
    应用程序必须删除和处理投递到它的线 程消息队列中的消息,单一线程的应用程序一般是在它的WinMain函数中使用一个消息环来删除消息,并把消息发送到相应的窗口过程进行处理。具有多重线 程的应用程序在创建窗口的每一个线程中使用一个消息环,下一节将讲述消息环是如何工作的,另外还解释了窗口过程的一般规则。
    消息环
    一个简单的消息环含有一个对下列函数的调 用:GetMessage, TranslateMessage和DispatchMessage。函数GetMessage从队列中检取一条消息并把它复制到一个MSG结构 中.GetMessage应返回TRUE,但如果它得到的是WM_QUIT消息,它就返回FALSE并结束循环。在单一线程的应用程序中,结束消息循环通 常是关闭应用程序的第一步。一般在应用程序主窗口的窗口过程中响应WM_DESTROY消息时,应用程序通过函数PostQuitMessage关闭它自 己的消息环。
    如果在 GetMessage中指定窗口句柄,那么从队列中检取的只是指定窗口的消息。GetMessage 也能过滤队列中的消息,这种情况下检取的只是指定范围内的消息。有关过滤消息,参见 “消息过滤”。
    如果某个线程想接收键盘的字符输入,那么线程消息环中必须含有 TranslateMessage。Windows系统在用户每按一次键时会产生一个虚键消息(WM_KEYDOWN和WM_KEYUP),虚键消息含有 一个标识哪一个键被按过的虚键码,但不是它的字符值,要得到这个值,消息环中必须含有TranslateMessage,由它来把虚键消息翻译成字符消息 (WM_CHAR),再把它放回到应用程序的消息队列中去.这样字符消息才能在消息环的下一轮循环中被发送到窗口过程。
    函数DispatchMessage把消息发送到与MSG结构 中指定的窗口句柄相应的窗口过程,如果窗口句柄是HWND_TOPMOST ,DispatchMessage就把消息发送到系统中所有顶层窗口的窗口过程。如果窗口句柄是NULL,对于这条消息DispatchMessage则 什么也不做。
    应用程序的主线 程在初始化应用程序并且至少创建了一个窗口之后就开始了消息循环,一旦开始,消息环就连续不断地从线程的消息队列中校取消息并把它们分发到相应的窗口,函 数GetMessage从消息队列中检取到WM_QUIT消息时,消息环就结束了。
    一个消息队列只需要有一个消息环,而不管应用程序有多少个窗口,因为队列中的每一条消息是一个 MSG结构,其中含有接收消息的窗口句柄,DispatchMessage总能把消息发送到相应的窗口。
    应用程序可以有多种方法修改它的消息环,例如,它可以从队列中检取消息但并不 发送到任何窗口,这对那些投递不指定窗口的消息的应用程序是很有用的,(这些消息是提供给应用程序的,而不是某个窗口,因为它们含有NULL窗口句柄)。 应用程序也能指导GetMessage来搜索队列中一个特定的消息,而不管其它消息,这对那些有时不按消息队列先进先出次序检取消息的应用程序来说是很有 用的。
    使用键盘加速键的应用 程序必须能够把键盘消息转换成命令消息,要这样做,应用程序的消息环必须调用函数TranslateAccelerator有关加速键,参见 “键盘加速键”。
    窗口过程
    窗口过程是一个函数,用来接收和处理 所有发送到该窗口的消息,每个窗口类都有一个窗口过程,同一窗口类所创建的窗口共用同一个窗口过程来响应消息。
    系统通过把消息数据作为过程的参数来向窗口过程发送消息,再由窗口过程 完成与消息相应的活动。它需要检查消息的标识,在处理消息时要使用由消息参数指定的这个信息。
    窗口过程一般不会忽略—条消息,如果它不处理某条消息,它就必须把这条消息传回系统进行 默认处理,窗口过程是调用函数DefWindowProc 来完成的,由它完成一个默认的操作并返回消息结果。绝大多数 窗口过程只处理几种类型的消息,其它的则通过调用DefWindowProc 传给了系统。
    因为窗口过程是由所有属于同类窗口共享的,所以它能处理 几个不同窗口的消息,要识别受消息影响的某个窗口,窗口过程可以检查消息所带的窗口句柄。有关窗口过程,参见 “窗口过程”。
    传递和发送消息
    任何应用程序都能投递和发送消息,就跟系统一样,应用程序投递一 条消息是通过把它复制到消息队列,发送消息则是通过把消息数据作为窗门过程的参数。要投递消息,应用程 序需 要用到函数PostMessage ,要发送消息,程序使用函数SendMessage, BroadcastSystemMessage, SendMessageCallback, SendMessageTimeout, SendNotifyMessage 或SendDlgItemMessage 。
    应用程序通常投递—条消息来通知某个窗口去完成 一个任务。PostMessage 为消息创建一个MSG 结构并把消息拷到消息队列 中,最后由应用程序的消息环检取这条消息再把它发送到相应的窗口过程。
    应用程序一般是通过发送一条消息通知窗口过程立即完成某项任务,函数SendMessage 把 消息发送到与给定窗口相应的窗口过程,这个函数要等待窗口过程完成处理井返回消息的结果。父窗口与子窗口之间也是通过发送消息来进行相互间的通信,例如, 某个父窗口有一个编辑控制框作为它的子窗口,就可通过向它发送消息设置控制框的正文,这个控制框则通过向父窗口发送消息来把用户对正文的改变通知其父窗 口。
    函数SendMessageCallback 也 能发送消息到指定窗口的窗口过程里,但是,这函数是立即返回,当窗口过程函数处理完消息后,系统调用指定的回调函数,有关更多回调函数信息,参考函数SendAsyncProc 。
    有时,应用程序也有可能要求 向系统中的所有顶层窗口发送或投递一条消息,例如,如果应用程序改变了系统的时间,它必须通过发送WM_TIMECHANGE 消 息来通知所有顶层窗口,应用程序向所有顶层窗口发送或投递一条消息是调用函数SendMessage 或PostMessage , 并在hwnd 参数中指定HWND_TOPMOST 。你同样通过函数BroadcastSystemMessage 指 定参数lpdwRecipients 的值为BSM_APPLICATIONS 来 广 播消息给所有程序
    应用程序能 够投递一条消息而不指定窗口,在调用PostMessage 时应用程序提供NULL 窗 口句柄,这条消息就被投递到与当前线程相应的队列中。因为没有指定窗口句柄,应用程序就必须在处理消息环中的这条消息,这也是一种创建消息的方法.此类消 息适用于整个应用程序,而不只是指某个窗口。
    使用函数InSendMessage 窗口过程能够确定它所处理的消息是从另一个线程发来的,这种能力 在需要根据消息源进行消息处理时是很有用的。
    经常出现的一个编程错误是假设函数PostMessage 总能成功地投递一条消息,这在消息队列是满 的时候是不对的,应用程序应该检查函数PostMessage 的返回值以确认消息是否已经被投递,否则要重新投递这条 消息。
    消息种类
    这部分将两种类型windows消 息;系统定义的消息,程序定义的消息
    系 统消息
    系统使用系统定义的 消息来控制应用程序的操作,并给应用程序提供输入或其他信息进行处理。系统在与应用程序进行通信是时是发送系统消息的。应用程序也能发送或投递系统消息, 应用程序通常用这些消息来控制预注册类创建的控制窗口的操作。
    每条系统消息都有一个唯一的消息标识,对应于一个符号常量(在Windows系统头文件中定义),它表明了消息的目的, 例如,常量WM_PAINT 要求窗口绘制它的内容。
    符号常量指定了系统消息所属的类别,常量的前缀标识能够解释和处理消息的亩口的类型。下表列出 了前缀及相应的消息类别:
    前 缀 消息类
    ABM Application desktop toolbar
    BM Button control
    CB Combo box control
    CDM Common dialog box
    DBT Device
    DL Drag list box
    DM Default push button control
    EM Edit control
    HDM Header control
    LB List box control
    LVM List view control
    PBM Progress bar
    PSM Property sheet
    SB Status bar window
    SBM Scroll bar control
    STM Static control
    TB Toolbar
    TBM Trackbar
    TCM Tab control
    TTM Tooltip control
    TVM Tree-view control
    UDM Up-down control
    WM General window
    通 用窗口消息覆盖了—个较大范围的信息和请求,包括鼠标和键盘输入消息、菜单和对话框输入消息、窗口创建和管理消息及动态数据交换消息(DDL)。
    应用程序定义消息
    应用程 序可创建用在它自己的窗口中的消息,或是与其它进程中的窗口进行通信的消息。如果应用程序创建了它自己的消息,接收它们的窗口过程必须能够对消息进行翻 译,并提供相应的处理。 ’
    windows 系统保留用于系统定义的消息的标识值的范围从0x0000到0x03FF(等于WM_USER —1)和0x8000到 0xBFFF应用程序不能把这些值用于私有消息。
    从0x0400(WM_USER 的值)到0x7FFF之间的值是可用于应用程序定义的用于它自己 的消息标识,而从0xC000到0xFFFF之间的值是应用程序为了与其它应用程序中的窗口进行通信所定义的消息标识。
    应用程序用函数RegisterWindowMessage 注 册一条消息时,windows系统返回的消息标识在0xC000到0xFFFF之间,这个函数所返回的消息标识应保证在整个系统中是唯一的。如果应用程序 要创建与其它应用程序中的窗口进行通信的消息,则使用RegisterWindowMessage 来对它进行注册,这 个函数可防止由于其它的应用程序基于不同的目的使用了相同的消息标识所产生的冲突。
    消息过滤
    应用程序可使用函数GetMessage 或PeekMessage 来 指定一个消息过滤器,从消息队列中检取指定的消息[忽略其它的消息),这是一个消息标识的范围(由第一个和最后一个标识指定)、一个窗口句柄或者两者都是GetMessage 和PeekMessage 利 用消息过滤器有选择地检取队列中的某条消息。如果某个应用程序必须检索消息队列中的排在后面的消息,消息过滤则是很有用的。
    过滤消息的应用程序必须保证满足消息过滤器的消息是能被投 递的,例如,如果某个应用程序的过滤器用于一个并不接收键盘输入的窗口中的WM_CHAR 消息,函数GetMessage 就 不能返回,这样就会“挂起”这个应用程序。
    要 过滤键盘、鼠标和DDE消息,应用程序可以便用下列常量WM_KEYFIRST 和 WM_KEYLAST, WM_MOUSEFIRST 和 WM_MOUSELAST messages, 和 WM_DDE_FIRST 和 WM_DDE_LAST
    消息死锁
    调 用函数SendMessage 的线程向另一个线程发送一条消息,要等待接收消息的窗口过程返回,如果接收消息的线程在 处理消息时放弃了控制,发送消息的线程就不能继续执行下去,因为它正等待SendMessage 返回,这种情况就叫做 死锁。接收消息的线程无须直接地放弃控制,调用下列函数其个的一个就能让线程放弃控制。
    DialogBox
    DialogBoxIndirect
    DialogBoxIndirectParam
    DialogBoxParam
    GetMessage
    MessageBox
    PeekMessage
    窗口过程可以确定它所接收的 消息是不是另一个线程通过调用函数InSendMessage 发来的。在处理一条消息时调用前面所列出的任一个函数之 前,窗口过程应首先调用InSendMessage ,如果函数返回TRUE ,窗口 过程就必须在调用任何能使线程放弃控制的函数之前调用函数ReplyMessage 。
    使用消息和消息队列
    这节描述如何完成下面的工作
    创建消息环
    检查消息队列
    投递消息
    发送消息
    创建消息环
    windows 系统为每一个线程自动创建消息队列,如果线程创建了一个或多个窗口,就必须提供从线程消息队列中检取消息,并把它们发送至相应窗口过程的消息环。
    因为windows系统指导向应用程 序中的某个窗口发送消息,线程就必须在启动它的消息环之前至少要创建—个窗口,绝大多数windows应用程序含有一个创建窗口的线程。一个典型的应用程 序是在函数WinMain 中注册它主窗口的窗口类。创建和显示主窗口.然后启动消息环。
    函数GetMessage 和 DispatchMessage 用来创建消息环,如果应用程序必须从用户得到字符输入,那么在消息环中应包含函数TranslateMessage , TranslateMessage 把 虚键消转换成字符消息。下面的范例说明了一个简单的windows应用程序的WinMain 函数中的消息环
    HINSTANCE hinst;
    HWND hwndMain;
    int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
    LPSTR lpszCmdLine, int nCmdShow)
    {
    MSG msg;
    WNDCLASS wc;
    UNREFERENCED_PARAMETER(lpszCmdLine);
    // Register the window class for the main window.
    if (!hPrevInstance)
    {
    wc.style = 0;
    wc.lpfnWndProc = (WNDPROC) WndProc;
    wc.cbClsExtra = 0;
    wc.cbWndExtra = 0;
    wc.hInstance = hInstance;
    wc.hIcon = LoadIcon((HINSTANCE) NULL, IDI_APPLICATION);
    wc.hCursor = LoadCursor((HINSTANCE) NULL, IDC_ARROW);
    wc.hbrBackground = GetStockObject(WHITE_BRUSH);
    wc.lpszMenuName = "MainMenu";
    wc.lpszClassName = "MainWndClass";
    if (!RegisterClass(&wc))
    return FALSE;
    }
    hinst = hInstance; // save instance handle
    // Create the main window.
    hwndMain = CreateWindow("MainWndClass", "Sample", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
    CW_USEDEFAULT, CW_USEDEFAULT, (HWND) NULL, (HMENU) NULL, hinst, (LPVOID) NULL);
    // If the main window cannot be created, terminate
    // the application.
    if (!hwndMain)
    return FALSE;
    // Show the window and paint its contents.
    ShowWindow(hwndMain, nCmdShow);
    UpdateWindow(hwndMain);
    // Start the message loop.
    while (GetMessage(&msg, (HWND) NULL, 0, 0))
    {
    TranslateMessage(&msg);
    DispatchMessage(&msg);
    }
    // Return the exit code to Windows.
    return msg.wParam;
    }
    函数GetMessage,TranslateMessage 以 及DispatchMessage 把MSG 结构的指针当作一个参数。如果有消息,GetMessage 把 它复制到MSG 结构中,如果这个消息是一条虚键消息(如WM_KEYDOWN 或WM_SYSKEYDOWN ),TranslateMessage 产 生一个字符消息(WM_CHAR 或WM_SYSCHAR ),并把它放到消息队列中 去。DispatchMessage 也使用MSG 结构的成员用作窗口过程的参数. 但要等到窗口过程完成处理后才返回。
    如 果某个线程支持加速键,那么它的消息环必须含有函数TranslateAccelerator 。这个函数检查与线程加 速键表中的一个入口相匹配的组合键,如果它找到一个匹配值.TranslateAccelerator 就把组合键翻译 成一条WM_COMMAND 消息,并把它发送到窗口过程。
    如果某个线程使用模式对话框,消息环中必须含有函数IsDialogMessage 以 便于对话框能够接收键盘输入。
    有 关对话框,参见“对话框”。
    下 面的范例说明了一个使用加速键的线程的消息环,其中显示了一个模式对话框。
    如果TranslateAccelerator 或IsDialogMessage 返 回TRUE (指示消息已被处理),就不再调用TranslateMessage 和 DispatchMessage 原因是TranslateAccelerator 或IsDialogMessage 完 成所有对消息的翻译和发送工作。
    HWND hwndMain;
    HWND hwndDlgModeless = NULL;
    MSG msg;
    HACCEL haccel;
    // Perform initialization and create a main window.
    while (GetMessage(&msg, (HWND) NULL, 0, 0))
    {
    if (hwndDlgModeless == (HWND) NULL ||
    !IsDialogMessage(hwndDlgModeless, &msg) &&
    !TranslateAccelerator(hwndMain, haccel,
    &msg))
    {
    TranslateMessage(&msg);
    DispatchMessage(&msg);
    }
    }
    检消息队列
    有时,应用程序需要在线程 消息环的外面检查线程消息队列的内容,例如,如果某个应用程序的窗口过程进行一个较长的绘画 操作,就可能允许用户中断这个操作。除非应用程序在处理鼠标和键盘消息的操作过程中不停地检查消息队列,否则在操作结束之前就不再会响应用户的输入.原因 是线程消息环中的函数DispatchMessage在窗口过程处理完消息之前是不会返回的。
    对于一个较长时间的操作,可使用函数PeekMessage来 检查消息队列,PeekMessage与函数GetMessage是很相似的,都 可用来检查消息队列中与过滤器标准相匹配的消息,再把这个消息复制到一个MSG结构中。它们之间主要的不同就是GetMessage要 等待队列中出现一条与过滤器标准相匹配的消息,而PeekMessage 会立即返回,不管队列中是否有某条消息。
    下面的范例说明了如何使用PeekMessage在 一个长操作期间,检查消息队列中的一条单击鼠标或键盘输入消息。
    HWND hwnd;
    BOOL fDone;
    MSG msg;
    // Begin the operation and continue until it is complete
    // or until the user clicks the mouse or presses a key.
    fDone = FALSE;
    while (!fDone)
    {
    fDone = DoLengthyOperation(); // application-defined function
    // Remove any messages that may be in the queue. If the
    // queue contains any mouse or keyboard
    // messages, end the operation.
    while (PeekMessage(&msg, hwnd, 0, 0, PM_REMOVE))
    {
    switch(msg.message)
    {
    case WM_LBUTTONDOWN:
    case WM_RBUTTONDOWN:
    case WM_KEYDOWN:
    // Perform any required cleanup.
    fDone = TRUE;
    }
    }
    }
    其它的函数如GetQueueStatus和GetInputState也 能用来检查线程消息队列中的内容,GetQueueStatus返回一组标志,用来指明队列中消息的类型,这是一个最 快的办法来确定队列中是否有消息,如果队列中台有鼠标或键盘消息,GetInputState就返回TRUE, 这两个函数都能用来确定队列中是否有需要处理的消息。
    投递消息
    使用函数PostMessage把一条消息投递到消息队列中,PostMessage在 线程消息队列的最后放置消息并立即返回,它不等待线程处理这条消息。函数的参数包括窗口句柄、消息标识相两个消息参数,windows系统把这些参数复制 到一个MSG结构中,填充结构的time和pt成 员,再把这个结构放到消息队列中。
    windows 系统用函数PostMessage所带的窗口句柄来决定哪一个线程消息队列接收消息.如果句柄是HWND_TOPMOST,windows 系统就把这条消息投递到所有顶层窗口的线程消息队列中。
    函数PostThreadMessage可用来向一个指定的线程消息队列投递消息,PostThreadMessage与PostMessage也 很相似.只是它的第一个参数是线程标识而不是窗口句柄,可通过调用函数GetCurrentThreadId检取这个 线程标识。
    函数PostQuitMessage用 来退出消息环,PostQuitMessage向当前正在执行的线程发送WM_QUIT消 息,如果线程消息环接收到WM_QUIT消息,就结束消息环并把控制返回给windows系统。应用程序通常调用PostQuitMessage响 应WM_DESTROY消息,
    用法如下
    case WM_DESTROY:
    // Perform cleanup tasks.
    PostQuitMessage(0);
    break;
    发送消息
    函数SendMessage是用来直接向 一个窗口过程发送消息,SendMessage调用一个窗口过程,并等待过程对消息的处理和返回结果。 一条消息可以被发往系统中的任何一个窗口,而仅要求有一个窗口句柄,windows系统用这个句柄决定哪一个窗口过程应该接收这条消息。 如果窗口过程在处理由另一个线程发来的消息时放弃控制,就会出现消息死锁(有关消息死锁,参见 “消息死锁”)。在处理一个可能是发自另一个线程的消息之前,窗口过程应首先调用函数InSendMessage,如 果这个函数返回TRUE,那么窗口过程就应在调用任何可以使线程放弃控制的函数之前调用ReplyMessage, 做法如下:
    case WM_USER + 5:
    if (InSendMessage())
    ReplyMessage(TRUE);
    DialogBox(hInst, "MyDialogBox", hwndMain, (DLGPROC) MyDlgProc);
    break;
    有一些消息可以发给对话框中的控制框,这些控制框消息设置控制框的外观、特性和内容或是检取有关 控制框的信息。例如,CB_ADDSTRING消息可以向组合框添加字串,BM_SETCHECK消 息能够设置复选框或单选按钮的选择状态。
    使 用函数SendDlgItemMessage向一个控制框发送一条消息,要指定控制框的标识,含有这个控制框的对话框 窗口的句柄。下面的范例用在对话框过程中的,把一个字串从组合框的编辑控制框拷到它的列表框,这个例子用SendDlgItemMessage向 组合框发送一条CB_ADDSTRING消息.
    HWND hwndCombo;
    int cTxtLen;
    PSTR pszMem;
    switch (uMsg)
    {
    case WM_COMMAND:
    switch (LOWORD(wParam))
    {
    case IDD_ADDCBITEM:
    // Get the handle of the combo box and the
    // length of the string in the edit control
    // of the combo box.
    hwndCombo = GetDlgItem(hwndDlg, IDD_COMBO);
    cTxtLen = GetWindowTextLength(hwndCombo);
    // Allocate memory for the string and copy
    // the string into the memory.
    pszMem=(PSTR)VirtualAlloc((LPVOID)NULL,(DWORD)(cTxtLen+1),MEM_COMMIT, PAGE_READWRITE);
    GetWindowText(hwndCombo, pszMem, cTxtLen + 1);
    // Add the string to the list box of the
    // combo box and remove the string from the
    // edit control of the combo box.
    if (*pszMem != NULL)
    {
    SendDlgItemMessage(hwndDlg, IDD_COMBO, CB_ADDSTRING, 0, (DWORD) ((LPSTR) pszMem));
    SetWindowText(hwndCombo, (LPSTR) NULL);
    }
    // Free the memory and return.
    VirtualFree(pszMem, 0, MEM_RELEASE);
    return TRUE;
    // Process other dialog box commands.
    }
    // Process other dialog box messages.
    }
    消息及消息队列参考
    下列函数函数用于消息和消息队列
    BroadcastSystemMessage
    DefWindowProc
    DispatchMessage
    GetInputState
    GetMessage
    GetMessageExtraInfo
    GetMessagePos
    GetMessageTime
    GetQueueStatus
    InSendMessage
    PeekMessage
    PostMessage
    PostQuitMessage
    PostThreadMessage
    RegisterWindowMessage
    ReplyMessage
    SendAsyncProc
    SendMessage
    SendMessageCallback
    SendMessageTimeout
    SendNotifyMessage
    SetMessageExtraInfo
    TranslateMessage
    WaitMessage
    Obsolete Functions
    PostAppMessage
    SetMessageQueue
    WM_USER

    展开全文
  • windows消息机制详解

    2018-03-19 23:11:45
    1. 引言 Windows 在操作系统平台占有绝对统治地位,基于...而很多Windows 程序开发人员也只是对消息运行机制一知半解, 想要掌握Windows 编程的核心,必须深刻理解消息机制。事件驱动围绕着消息的产生与处 理展开...
    1. 引言

    Windows 在操作系统平台占有绝对统治地位,基于Windows 的编程和开发越来越广泛。
    Dos 是过程驱动的,而Windows 是事件驱动的[6],这种差别的存在使得很多Dos 程序员不能
    习惯Windows 的程序开发。而很多Windows 程序开发人员也只是对消息运行机制一知半解,
    想要掌握Windows 编程的核心,必须深刻理解消息机制。事件驱动围绕着消息的产生与处
    理展开,事件驱动是靠消息循环机制来实现的。也可以理解为消息是一种报告有关事件发生
    的通知,消息是Windows 操作系统的灵魂,掌握了消息运行机制就掌握了Windows 编程的
    神兵利器。本文将首先阐述Windows 的编程原理,继而对Windows 的消息运行机制进行分
    析,并讲述对消息的处理。MFC 是一个广为使用的编程类库,对Windows 的消息机制进行
    了良好的封装,所以,在第二部分将着重讨论MFC 的消息映射,最后结合编程实际,通过
    对MFC 消息映射的分析,非常巧妙的加以应用,以帮助解决实际问题

     

    2. Windows 消息运行机制
    在介绍Windows 消息运行机制之前,首先介绍一下消息的概念。
    2.1 消息的概念和表示
    消息(Message)指的就是Windows 操作系统发给应用程序的一个通告[5],它告诉应用
    程序某个特定的事件发生了。比如,用户单击鼠标或按键都会引发Windows 系统发送相应
    的消息。最终处理消息的是应用程序的窗口函数,如果程序不负责处理的话系统将会作出默
    认处理。
    从数据结构[4]的角度来说,消息是一个结构体,它包含了消息的类型标识符以及其他的
    一些附加信息。
    系统定义的结构体MSG[1]用于表示消息,MSG 具有如下定义形式:
    typedef struct tagMSG
    {
    HWND hwnd;
    UINT message;
    WPARAM wParam;
    LPARAM lParam;
    DWORD time;
    POINT pt;
    }MSG;

     

    其中hwnd 是窗口的句柄,这个参数将决定由哪个窗口过程函数对消息进行处理;message
    是一个消息常量,用来表示消息的类型;wParam 和lParam 都是32 位的附加信息,具体表
    示什么内容,要视消息的类型而定;time 是消息发送的时间;pt 是消息发送时鼠标所在的位
    置。

     

    2.2 Windows 编程原理
    Windows 是一消息(Message)驱动式系统,Windows 消息提供了应用程序与应用程序
    之间、应用程序与Windows 系统之间进行通讯的手段。应用程序要实现的功能由消息来触
    发,并靠对消息的响应和处理来完成。Windows 系统中有两种消息队列,一种是系统消息队
    列,另一种是应用程序消息队列。计算机的所有输入设备由 Windows 监控,当一个事件发
    生时,Windows 先将输入的消息放入系统消息队列中,然后再将输入的消息拷贝到相应的应
    用程序队列中,应用程序中的消息循环从它的消息队列中检索每一个消息并发送给相应的窗
    口函数中。一个事件的发生,到达处理它的窗口函数必须经历上述过程。
    所谓消息就是描述事件发生的信息,Windows 程序是事件驱动的,用这一方法编写程序
    避免了死板的操作模式,因为Windows 程序的执行顺序将取决于事件的发生顺序,具有不
    可预知性。Windows 操作系统,计算机硬件,应用程序之间具有如图1 所示的关系

    箭头1 说明操作系统能够操纵输入输出设备,例如让打印机打印;箭头2 说明操作系统
    能够感知输入输出设备的状态变化,如鼠标单击,按键按下等,这就是操作系统和计算机硬
    件之间的交互关系,应用程序开发者并不需要知道他们之间是如何做到的,我们需要了解的
    操作系统与应用程序之间如何交互。箭头3 是应用程序通知操作系统执行某个具体的操作,
    这是通过调用操作系统的API 来实现的;操作系统能够感知硬件的状态变化,但是并不决
    定如何处理,而是把这种变化转交给应用程序,由应用程序决定如何处理,向上的箭头4
    说明了这种转交情况,操作系统通过把每个事件都包装成一个称为消息结构体MSG 来实现
    这个过程,也就是消息响应,要理解消息响应,首先需要了解消息的概念和表示。

     

    2.3 Windows 消息循环
    消息循环[1]是Windows 应用程序存在的根本,应用程序通过消息循环获取各种消息,并
    通过相应的窗口过程函数,对消息加以处理;正是这个消息循环使得一个应用程序能够响应
    外部的各种事件,所以消息循环往往是一个Windows 应用程序的核心部分。
    Windows 的消息机制如图2 所示:

     

    Windows 操作系统为每个线程维持一个消息队列,当事件产生时,操作系统感知这一事
    件的发生,并包装成消息发送到消息队列,应用程序通过GetMessage()函数取得消息并存于
    一个消息结构体中,然后通过一个TranslateMessage()和DispatchMessage()解释和分发消息,
    下面的代码描述了Windows 的消息循环。
    while(GetMessage (&msg, NULL, 0, 0))
    {
    TranslateMessage (&msg) ;
    DispatchMessage (&msg) ;
    }
    TranslateMessage(&msg)对于大多数消息而言不起作用,但是有些消息,比如键盘按键按
    下和弹起(分别对于KeyDown 和KeyUp 消息),却需要通过它解释,产生一个WM_CHAR
    消息。DispatchMessage(&msg)负责把消息分发到消息结构体中对应的窗口,交由窗口过程
    函数处理。GetMessage()在取得WM_QUIT 之前的返回值都为TRUE,也就是说只有获取到
    WM_QUIT 消息才返回FALSE,才能跳出消息循环。

     

    2.4 消息的处理
    取得的消息将交由窗口处理函数进行处理,对于每个窗口类Windows 为我们预备了一个
    默认的窗口过程处理函数DefWindowProc(),这样做的好处是,我们可以着眼于我们感兴趣
    的消息,把其他不感兴趣的消息传递给默认窗口过程函数进行处理。每一个窗口类都有一个
    窗口过程函数,此函数是一个回调函数,它是由Windows 操作系统负责调用的,而应用程
    序本身不能调用它。以switch 语句开始,对于每条感兴趣的消息都以一个case 引出。
    LRESULT CALLBACK WndProc
    (
    HWND hwnd,
    UINT message,
    WPARAM wParam,
    LPARAM lParam
    )
    {

    switch(uMsgId)
    {

    case WM_TIMER://对WM_TIMER 定时器消息的处理过程
    return 0;
    case WM_LBUTTONDOWN://对鼠标左键单击消息的处理过程
    reurn 0;
    . …
    default:
    return DefWindowProc(hwnd,uMsgId,wParam,lParam);
    }
    }
    对于每条已经处理过的消息都必须返回0,否则消息将不停的重试下去;对于不感兴趣
    的消息,交给DefWindowProc()函数进行处理,并需要返回其处理值。


    3. MFC 的消息映射
    MFC 是Windows 下编程的微软基础类库,封装了大部分Windows API 和Windows 控件,
    提供了一套消息映射和命令响应机制,方便了应用程序的开发。MFC 只是通过对Windows
    消息映射的进行封装,使得添加消息响应变得更为简单,但深究起来,与Windows 消息机
    制有一样的底层实现。


    3.1 MFC 消息映射的实现
    在MFC 的框架结构下,“消息映射”是通过巧妙的宏定义,形成一张消息映射表格来进
    行的。这样一旦消息发生,Framework 就可以根据消息映射表格来进行消息映射和命令传递。
    首先在需要进行消息处理的类的头文件(.H)里,都会含有DECLARE_MESSAGE_MAP()
    宏,声明该类拥有消息映射表格。
    然后在类应用程序文件(.CPP)实现这一表格
    BEGIN_MESSAGE_MAP(CInheritClass, CBaseClass)
    //{{AFX_MSG_MAP(CInheritClass)
    ON_COMMAND(ID_EDIT_COPY,OnEditCopy)
    ………
    //}}AFX_MSG_MAP
    END_MESSAGE_MAP()
    这里主要进行消息映射的实现,把它和消息处理函数联系在一起。其中出现三个宏,第
    一个宏是BEGIN_MESSAGE_MAP 有两个参数,分别是拥有消息表格的类,及其父类。第
    二个宏是ON_COMMAND , 指定命令消息的处理函数名称。第三个是
    END_MESSAGE_MAP()作为结尾符号。
    DECLARE_MESSAGE_MAP 宏定义里包含了MFC 定义的两个新的数据结构;
    AFX_MSGMAP_ENTRY 和AFX_MSGMAP;其中AFX_MSGMAP_ENTRY 结构包含了
    一个消息的所有相关信息,而AFX_MSGMAP 主要作用有两个,一是用来得到基类的消息映
    射入口地址。二是得到本身的消息映射入口地址。
    实际上,MFC 把所有的消息一条条填入到AFX_MSGMAP_ENTRY 结构中去,形成一
    个数组,该数组存放了所有的消息和与它们相关的参数。同时通过AFX_MSGMAP 能得到
    该数组的首地址,同时得到基类的消息映射入口地址。当本身对该消息不响应的时候,就可
    以上溯到基类的消息映射表寻找对应的消息响应。
    MFC 通过钩子函数_AfxCbtFilterHook()截获消息,并在此函数中把窗口过程函数设置为

    AfxWindProc,而原来的窗口过程函数被保存在成员变量m_pfnSuper 中。
    在MFC 框架下,通过下面的步骤来对消息进行映射[7]。
    1 函数AfxWndProc 接收Windows 操作系统发送的消息。
    2 函数AfxWndProc 调用函数AfxCallWndProc 进行消息处理,这里一个进步是把对句柄的
    操作转换成对CWnd 对象的操作。
    3 函数AfxCallWndProc 调用CWnd 类的方法WindowProc 进行消息处理。
    4 WindowProc 调用OnWndMsg 进行正式的消息处理,即把消息派送到相关的方法中去处理。
    5 如果OnWndMsg 方法没有对消息进行处理的话,就调用DefWindowProc 对消息进行处理。
    这就是MFC 对消息调用过程的巧妙封装。


    3.2 MFC 消息分类


    1 命令消息(WM_COMMAND)
    比如菜单项的选择,工具栏按钮点击等发出该消息。所有派生自CCmdTarget 的类都有
    能力接收WM_COMMAND 消息。


    2 标准消息(WM_XXX)
    比如窗口创建,窗口销毁等。所有派生自CWnd 的类才有资格接收标准消息。


    3 通告消息(WM_NOTIFY)
    这是有控件向父窗口发送的消息,标示控件本身状态的变化。比如下拉列表框选项的改
    变CBN_SELCHANGE 和树形控件的TVN_SELCHANGED 消息都是通告消息。
    Window 9x 版及以后的新控件通告消息不再通过WM_COMMAND 传送,而是通过
    WM_NOTIFY 传送, 但是老控件的通告消息, 比如CBN_SELCHANGE 还是通过
    WM_COMMAND 消息发送。


    4 自定义消息
    利用MFC 编程,可以使用自定义消息。使用自定义消息需要遵循一定的步骤[2]并需要
    自己编写消息响应函数

     


    4. MFC 消息的灵活运用
    在此,我们给出一个示例程序,演示对MFC 消息的灵活运用,通过此例的剖析,将加
    深我们对MFC 消息的理解。


    4.1 示例功能描述
    本示例程序将演示这样一种效果:
    对话框上有一个CTabCtrl 控件,一个CComboBox 控件,两个按钮Button1 和Button2。
    CTabCtrl 控件有两个标签页Tab1 和Tab2;CComboxBox 有两个选项:选项1 和选项2;通
    过按钮(Button1 和Button2)单击,分别发送CTabCtrl 控件的TCN_SELCHANGE 消息和
    下拉列表框的CBN_SELCHANGE 消息,在各自的消息响应函数中只是简单的对控件选项做
    切换和给出提示信息。
    单击Button1 将选中标签页Tab1 和下拉列表框的选项1,并弹出提示信息;单击Button2
    将选中标签页Tab2 和下拉列表框的选项2,并弹出提示信息。


    4.2 程序设计思路
    TCN_SELCHANGE 消息和CBN_SELCHANGE 消息都属于通告消息,此消息由子控件

    发送给父窗口,在MSDN 中查询发现TCN_SELCHANGE 消息是以WM_NOTIFY 消息的形
    式发送,在MSDN 中查询WM_NOTIFY 消息:
    idCtrl = (int) wParam;
    pnmh = (LPNMHDR) lParam;
    也就是说,WPARAM 参数传递发送此消息的控件标识,LAPAM 参数一个指向NMHDR
    结构体的指针。NMHDR 结构体定义如下:
    typedef struct tagNMHDR
    {
    HWND hwndFrom;
    UINT idFrom;
    UINT code;
    }
    NMHDR; 其中hwndFrom 标识发送消息控件的句柄,idFrom 是发送消息控件的ID,code
    则是消息码,如果要发送TCN_SELCHANGE 消息,则以TCN_SELCHANGE 填充。
    查询MSDN 发现, 由CComboBox 控件发送的CBN_SELCHANGE 消息以
    WM_COMMAND 消息发送,WPARAM 的高字节传递CComboBox 控件的ID,低字节发送
    消息码CBN_SELCHANGE,而LPARAM 则传送发送此消息的控件句柄。
    所以我们可以通过在按钮控件的单击响应函数里分别发送WM_NOTIFY 和
    WM_COMMAND 消息来引起TCN_SELCHANGE 和CBN_SELCHANGE 消息响应函数的调
    用,分别在两控件消息响应函数中实现选项改变和消息提示即可,遵照这种思路,我们就可
    以实现我们想要的功能。


    4.3 程序实现步骤
    启动VC++6.0,新建基于对话框的应用程序MsgTest.
    在对话框上添加1 个CTabCtrl 控件,一个CComboBox 控件,2 个按钮Button1 和Button2;
    给IDC_TAB1 和IDC_COMBO1 分别关联控件成员变量m_tab1 和m_cb1;为两按钮分
    别添加按钮单击响应函数。
    在对话框的OnInitDlg()函数中为CTabCtrl 控件添加两个标签页,Tab1 和Tab2;为
    ComboBox 添加选项1 和2;代码如下:
    m_tab1.InsertItem(0,"Tab1");
    m_tab1.InsertItem(1,"Tab2");
    m_cb1.AddString("选项1");
    m_cb1.AddString("选项2");
    用ClassWizard 为CTabCtrl 添加消息响应TCN_SELCHANGE,为CComboBox 添加消息
    响应CBN_SELCHANGE。在OnSelchangeTab1()函数中添加代码
    int nIndex=m_tab1.GetCurSel();
    CString str;
    str.Format("%d",nIndex+1);
    MessageBox("Tab"+str+" selected!");
    在OnSelchangeCombo1()函数中添加代码:
    int nIndex=m_cb1.GetCurSel();
    CString str;
    str.Format("%d",nIndex+1);

     

    MessageBox("ComboBox 选项"+str+" selected!");
    在按钮1 的响应函数OnButton1()中添加代码:
    m_tab1.SetCurSel(0);
    NMHDR nmhdr;
    nmhdr.code=TCN_SELCHANGE;
    nmhdr.hwndFrom=GetDlgItem(IDC_TAB1)->m_hWnd;
    nmhdr.idFrom=IDC_TAB1;
    SendMessage(WM_NOTIFY,(WPARAM)IDC_TAB1,(LPARAM)&nmhdr);
    m_cb1.SetCurSel(0);
    WPARAM wParam=0;
    WPARAM lParam=0;
    wParam=IDC_COMBO1;
    wParam= wParam | (CBN_SELCHANGE<<16);
    lParam=(WPARAM)(GetDlgItem(IDC_COMBO1)->m_hWnd);
    SendMessage(WM_COMMAND, wParam, lParam);
    在按钮2 的响应函数OnButton2()中添加类似代码,只需要把m_tab1.SetCurSel(0)和
    m_cb1.SetCurSel(0)分别改成m_tab1.SetCurSel(1)和m_cb1.SetCurSel(1)。
    通过SendMessage() 函数向控件的父窗口也就是对话框窗口发送相应的消息,
    TCN_SELCHANGE 是以WM_NOTIFY 消息的形式发送,参数WPARAM 标识发送
    TCN_SELCHANGE 消息的控件ID,LPARAM 是一个NMHDR 结构体的指针,此结构体的
    成员code 标识发送什么通告消息,此处是TCN_SELCHANGE,hwndFrom 是发送消息的控
    件句柄, 程序中用GetDlgItem()->m_hWdn 获得, idFrom 是发送消息的控件ID 。
    CBN_SELCHANGE 以WM_COMMAND 消息的形式发送,同样的,通过查阅MSDN,可以
    对此消息的两个参数进行赋值,以保证消息的正确发送。
    通过上面的5 个步骤,我们的程序就编写完成了,单击Button1,可以发现,CTabCtrl
    切换到了Tab1 标签页,CComboBox 选择了“选项1”,并弹出消息对话框。由此可见确实引
    起了消息响应函数的调用,完成了预定的功能。
    通过查阅MSDN,可以得到其他消息的发送和包装形式,我们可以方便的加以利用,完
    成更为复杂的功能,可以说,掌握了Windows 的消息机制,就掌握了Windows 编程的核心。

     


    5. 总结
    Windows 消息机制是Windows 编程的本质和核心,对Windows 消息机制的理解能提高
    我们Windows 程序开发的能力。本文首先阐述Windows 的消息机制,然后讲解了MFC 的
    消息映射,消息分类,最后通过示例程序,讲解如何借助MSDN,灵活运用消息编程,解
    决实际问题。本文对Windows 下的程序开发具有一定的参考和借鉴意义。

    展开全文
  • 消息,就是指Windows发出的一个通知,告诉应用程序某个事情发生了。例如,单击鼠标、改变窗口尺寸、按下键盘上的一个键都会使Windows发送一个消息给应用程序。消息本身是作为一个记录传递给应用程序的,这个记录中...

    消息,就是指Windows发出的一个通知,告诉应用程序某个事情发生了。例如,单击鼠标、改变窗口尺寸、按下键盘上的一个键都会使Windows发送一个消息给应用程序。消息本身是作为一个记录传递给应用程序的,这个记录中包含了消息的类型以及其他信息。例如,对于单击鼠标所产生的消息来说,这个记录中包含了单击鼠标时的坐标。这个记录类型叫做TMsg,

    它在Windows单元中是这样声明的:
    type
    TMsg = packed record
    hwnd: HWND; / /窗口句柄
    message: UINT; / /消息常量标识符
    wParam: WPARAM ; // 32位消息的特定附加信息
    lParam: LPARAM ; // 32位消息的特定附加信息
    time: DWORD; / /消息创建时的时间
    pt: TPoint; / /消息创建时的鼠标位置
    end;

    消息中有什么?
    是否觉得一个消息记录中的信息像希腊语一样?如果是这样,那么看一看下面的解释:
    hwnd 32位的窗口句柄。窗口可以是任何类型的屏幕对象,因为Win32能够维护大多数可视对象的句柄(窗口、对话框、按钮、编辑框等)。
    message 用于区别其他消息的常量值,这些常量可以是Windows单元中预定义的常量,也可以是自定义的常量。
    wParam 通常是一个与消息有关的常量值,也可能是窗口或控件的句柄。
    lParam 通常是一个指向内存中数据的指针。由于WPARAM、LPARAM和Pointer都是32位的,因此,它们之间可以相互转换。

    消息类别
    消息和命令有三种主要类别: 
    1.Windows 消息 :
    主要包含以 WM_ 为前缀的消息,除了 WM_COMMAND。Windows 消息是由窗口和视图处理。这些消息通常有用来决定消息处理方式的参数。
    2.控件告知 :
    这包含从控件和其它子窗口传递到父窗口的 WM_COMMAND 告知消息。例如,当使用者采取可能会在编辑控件有变更文字的动作,编辑控件传送包含 EN_CHANGE 控件告知程序代码的 WM_COMMAND 消息到父窗口 (Parent)。消息的窗口处理例程以某些适当的方法响应告知消息,例如在控件中撷取文字。 
    架构像其它 WM_ 消息一样传送控件告知消息。然而,有一个例外,那就是 BN_CLICKED 控件告知消息是在使用者点选按钮时,由按钮来传送。这个消息特别被当作命令消息来对待,并且像其它的命令一样被传送。 
    3.命令消息 :
    这包含从使用者接口对象的 WM_COMMAND 告知消息:菜单、工具列按钮和快速键。架构处理命令与其它消息不同,而且可以由更多种对象来处理,如命令目标中所解释的。

    Windows 消息和控件告知消息:是由窗口来处理,从 CWnd 类别衍生出类别的对象。包含 CFrameWnd、CMDIFrameWnd、CMDIChildWnd、CView、CDialog 和您自己从这些基底类别 (Base Class) 衍生出的类别。这类的对象封装 HWND,其为一个 Windows 窗口的控制代码。
    命令消息:可以由更广泛种类的对象处理,除窗口和视图之外,还有文檔、文件样板和应用程序对象本身。当命令直接影响到一些特定的对象时,让该对象处理命令是对的。例如,在档案菜单的开启命令与应用程序在逻辑上有相关联:当接收到这个命令时,应用程序开启一个指定的文档。所以这个开启命令的处理例程是应用程序类别的一个成员函式。

    控件通告消息(Notification Message)由控件发往父窗口,而控件消息(Messages)则由外部发送给控件的。控件的父窗口通过(WM_COMMAND )消息接收控件的通告消息(Notification Message)。

    A window receives this message through its WindowProc function.窗口通过WindowProc()函数接收消息

    Range Meaning:
    0 through WM_USER–1: Messages reserved for use by the system. Message numbers in the first range (0 through WM_USER–1) are defined by the system. Values in this range that are not explicitly defined are reserved for future use by the system.

    WM_USER() through 0x7FFF: Integer messages for use by private window classes. Message numbers in the second range (WM_USER through 0x7FFF) can be defined and used by an application to send messages within a private window class. These values cannot be used to define messages that are meaningful throughout an application, because some predefined window classes already define values in this range. For example, predefined control classes such as BUTTON, EDIT, LISTBOX, and COMBOBOX may use these values. Messages in this range should not be sent to other applications unless the applications have been designed to exchange messages and to attach the same meaning to the message numbers.

    WM_APP(0x8000) through 0xBFFF: Messages available for use by applications. Message numbers in the third range (0x8000 through 0xBFFF) are available for application to use as private messages. Message in this range do not conflict with system messages.

    0xC000 through 0xFFFF: String messages for use by applications. Message numbers in the fourth range (0xC000 through 0xFFFF) are defined at run time when an application calls the RegisterWindowMessage function to retrieve a message number for a string. All applications that register the same string can use the associated message number for exchanging messages. The actual message number, however, is not a constant and cannot be assumed to be the same between different sessions.

    Greater than 0xFFFF: Reserved by the system for future use. Message numbers in the fifth range (greater than 0xFFFF) are reserved for future use by the system.

    Simple notifications are sent as special WM_COMMAND messages, with the notification code (such as BN_CLICKED) and control ID packed into wParam and the control’s handle in lParam.

    Remarks:备注,  注意, 注释

    消息返回值为Zero(0)(#define FALSE 0),则继续处理;返回Nonzero(非0)(#define TRUE 1),则停止处理。

    WM_NULL = H0000;

    WM_CREATE = H0001;
    应用程序创建一个窗口
    The WM_CREATE message is sent when an application requests that a window be created by calling the CreateWindowEx or CreateWindow function. The window procedure of the new window receives this message after the window is created, but before the window becomes visible. The message is sent before the CreateWindowEx or CreateWindow function returns. 
    WM_CREATE 
    lpcs = (LPCREATESTRUCT) lParam; // structure with creation data  
    Parameters
    lParam 
    Value of lParam. Pointer to a CREATESTRUCT structure that contains information about the window being created. The members of CREATESTRUCT are identical to the parameters of the CreateWindowEx function. 
    Return Values
    If an application processes this message, it should return 0 to continue creation of the window. If the application returns –1, the window is destroyed and the CreateWindowEx or CreateWindow function returns a NULL handle.

    WM_DESTROY = H0002;
    一个窗口被销毁
    The WM_DESTROY message is sent when a window is being destroyed. It is sent to the window procedure of the window being destroyed after the window is removed from the screen. 
    This message is sent first to the window being destroyed and then to the child windows (if any) as they are destroyed. During the processing of the message, it can be assumed that all child windows still exist. 
    WM_DESTROY  
    Parameters
    This message has no parameters. 
    Return Values
    If an application processes this message, it should return zero. 
    Remarks
    If the window being destroyed is part of the clipboard viewer chain (set by calling the SetClipboardViewer function), the window must remove itself from the chain by processing the ChangeClipboardChain function before returning from the WM_DESTROY message.

    WM_MOVE = H0003;
    移动一个窗口
    The WM_MOVE message is sent after a window has been moved. 
    WM_MOVE 
    xPos = (int)(short) LOWORD(lParam);    // horizontal position 
    yPos = (int)(short) HIWORD(lParam);    // vertical position  
    Parameters
    xPos 
    Value of the low-order word of lParam. Specifies the x-coordinate of the upper-left corner of the client area of the window. 
    yPos 
    Value of the high-order word of lParam. Specifies the y-coordinate of the upper-left corner of the client area of the window. 
    Return Values
    If an application processes this message, it should return zero. 
    Remarks
    The xPos and yPos parameters are given in screen coordinates for overlapped and pop-up windows and in parent-client coordinates for child windows. 
    An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

    WM_SIZE = H0005;
    改变一个窗口的大小
    The WM_SIZE message is sent to a window after its size has changed. 
    WM_SIZE 
    fwSizeType = wParam;      // resizing flag 
    nWidth = LOWORD(lParam);  // width of client area 
    nHeight = HIWORD(lParam); // height of client area  
    Parameters
    fwSizeType 
    Value of wParam. Specifies the type of resizing requested. This parameter can be one of the following values: Value Meaning 
    SIZE_MAXHIDE Message is sent to all pop-up windows when some other window is maximized. 
    SIZE_MAXIMIZED The window has been maximized. 
    SIZE_MAXSHOW Message is sent to all pop-up windows when some other window has been restored to its former size. 
    SIZE_MINIMIZED The window has been minimized. 
    SIZE_RESTORED The window has been resized, but neither the SIZE_MINIMIZED nor SIZE_MAXIMIZED value applies. 
    nWidth 
    Value of the low-order word of lParam. Specifies the new width of the client area. 
    nHeight 
    Value of the high-order word of lParam. Specifies the new height of the client area. 
    Return Values
    If an application processes this message, it should return zero. 
    Remarks
    If the SetScrollPos or MoveWindow function is called for a child window as a result of the WM_SIZE message, the bRedraw parameter should be nonzero to cause the window to be repainted. 
    Although the width and height of a window are 32-bit values, the nWidth and nHeight parameters of the WM_SIZE message contain only the low-order 16 bits.

    WM_ACTIVATE = H0006;
    一个窗口被激活或失去激活状态;
    The WM_ACTIVATE message is sent to both the window being activated and the window being deactivated. If the windows use the same input queue, the message is sent synchronously, first to the window procedure of the top-level window being deactivated, then to the window procedure of the top-level window being activated. If the windows use different input queues, the message is sent asynchronously, so the window is activated immediately. 
    WM_ACTIVATE 
    fActive = LOWORD(wParam);           // activation flag 
    fMinimized = (BOOL) HIWORD(wParam); // minimized flag 
    hwndPrevious = (HWND) lParam;       // window handle  
    Parameters
    fActive 
    Value of the low-order word of wParam. Specifies whether the window is being activated or deactivated. This parameter can be one of the following values. Value Meaning 
    WA_ACTIVE Activated by some method other than a mouse click (for example, by a call to the SetActiveWindow function or by use of the keyboard interface to select the window). 
    WA_CLICKACTIVE Activated by a mouse click. 
    WA_INACTIVE Deactivated. 
    fMinimized 
    Value of the high-order word of wParam. Specifies the minimized state of the window being activated or deactivated. A nonzero value indicates the window is minimized. 
    hwndPrevious 
    Value of lParam. Handle to the window being activated or deactivated, depending on the value of the fActive parameter. If the value of fActive is WA_INACTIVE, hwndPrevious is the handle to the window being activated. If the value of fActive is WA_ACTIVE or WA_CLICKACTIVE, hwndPrevious is the handle to the window being deactivated. This handle can be NULL. 
    Return Values
    If an application processes this message, it should return zero. 
    Default Action
    If the window is being activated and is not minimized, the DefWindowProc function sets the keyboard focus to the window. 
    Remarks
    If the window is activated by a mouse click, it also receives a WM_MOUSEACTIVATE message.

    WM_SETFOCUS = H0007;
    获得焦点后
    The WM_SETFOCUS message is sent to a window after it has gained the keyboard focus. 
    WM_SETFOCUS 
    hwndLoseFocus = (HWND) wParam; // handle to window losing focus  
    Parameters
    hwndLoseFocus 
    Value of wParam. Handle to the window that has lost the keyboard focus (may be NULL). 
    Return Values
    An application should return zero if it processes this message. 
    Remarks
    To display a caret, an application should call the appropriate caret functions when it receives the WM_SETFOCUS message.

    WM_KILLFOCUS = H0008;
    失去焦点
    The WM_KILLFOCUS message is sent to a window immediately before it loses the keyboard focus. 
    WM_KILLFOCUS 
    hwndGetFocus = (HWND) wParam; // handle to window receiving focus  
    Parameters
    hwndGetFocus 
    Value of wParam. Handle to the window that receives the keyboard focus (may be NULL). 
    Return Values
    An application should return zero if it processes this message. 
    Remarks
    If an application is displaying a caret, the caret should be destroyed at this point.

    WM_ENABLE = H000A;
    改变enable状态
    The WM_ENABLE message is sent when an application changes the enabled state of a window. It is sent to the window whose enabled state is changing. This message is sent before the EnableWindow function returns, but after the enabled state (WS_DISABLED style bit) of the window has changed. 
    WM_ENABLE 
    fEnabled = (BOOL) wParam;   // enabled/disabled flag 
    Parameters
    fEnabled 
    Value of wParam. Specifies whether the window has been enabled or disabled. This parameter is TRUE if the window has been enabled or FALSE if the window has been disabled. 
    Return Values
    If an application processes this message, it should return zero.

    WM_SETREDRAW = H000B;
    设置窗口是否能重画
    An application sends the WM_SETREDRAW message to a window to allow changes in that window to be redrawn or to prevent changes in that window from being redrawn. 
    WM_SETREDRAW 
    wParam = (WPARAM) fRedraw;  // state of redraw flag 
    lParam = 0;                 // not used; must be zero  
    Parameters
    fRedraw 
    Value of wParam. Specifies the state of the redraw flag. If this parameter is TRUE, the redraw flag is set. If the parameter is FALSE, the flag is cleared. 
    Return Values
    An application returns zero if it processes this message. 
    Remarks
    This message sets or clears the redraw flag. If the redraw flag is cleared, the content of the given window is not updated after each change, and the window is not repainted until the redraw flag is set. For example, an application that must add several items to a list box can clear the redraw flag, add the items, and then set the redraw flag. Finally, the application can call the InvalidateRect function to cause the list box to be repainted.

    WM_SETTEXT = H000C;
    应用程序发送此消息来设置一个窗口的文本
    An application sends a WM_SETTEXT message to set the text of a window. 
    WM_SETTEXT 
    wParam = 0;                     // not used; must be zero 
    lParam = (LPARAM)(LPCTSTR)lpsz; // address of window-text string  
    Parameters
    lpsz 
    Value of lParam. Pointer to a null-terminated string that is the window text. 
    Return Values
    The return value is TRUE if the text is set. It is FALSE (for an edit control), LB_ERRSPACE (for a list box), or CB_ERRSPACE (for a combo box) if insufficient space is available to set the text in the edit control. It is CB_ERR if this message is sent to a combo box without an edit control. 
    Default Action
    The DefWindowProc function sets and displays the window text. 
    Remarks
    For an edit control, the text is the contents of the edit control. For a combo box, the text is the contents of the edit-control portion of the combo box. For a button, the text is the button name. For other windows, the text is the window title. 
    This message does not change the current selection in the list box of a combo box. An application should use the CB_SELECTSTRING message to select the item in a list box that matches the text in the edit control.

    WM_GETTEXT = H000D;
    应用程序发送此消息来复制对应窗口的文本到缓冲区
    An application sends a WM_GETTEXT message to copy the text that corresponds to a window into a buffer provided by the caller. 
    WM_GETTEXT 
    wParam = (WPARAM) cchTextMax;   // number of characters to copy 
    lParam = (LPARAM) lpszText;     // address of buffer for text 
     Parameters
    cchTextMax 
    Value of wParam. Specifies the maximum number of characters to be copied, including the terminating null character. 
    lpszText 
    Value of lParam. Pointer to the buffer that is to receive the text. 
    Return Values
    The return value is the number of characters copied. 
    Default Action
    The DefWindowProc function copies the text associated with the window into the specified buffer and returns the number of characters copied. 
    Remarks
    For an edit control, the text to be copied is the content of the edit control. For a combo box, the text is the content of the edit control (or static-text) portion of the combo box. For a button, the text is the button name. For other windows, the text is the window title. To copy the text of an item in a list box, an application can use the LB_GETTEXT message. 
    When the WM_GETTEXT message is sent to a static control with the SS_ICON style, a handle to the icon will be returned in the first four bytes of the buffer pointed to by lpszText. This is true only if the WM_SETTEXT message has been used to set the icon. 
    In a rich edit control, if the text to be copied exceeds 64K, use either the message EM_STREAMOUT or EM_GETSELTEXT.

    WM_GETTEXTLENGTH = H000E;
    得到与一个窗口有关的文本的长度(不包含空字符)
    An application sends a WM_GETTEXTLENGTH message to determine the length, in characters, of the text associated with a window. The length does not include the terminating null character. 
    WM_GETTEXTLENGTH 
    wParam = 0; // not used; must be zero 
    lParam = 0; // not used; must be zero  
    Parameters
    This message has no parameters. 
    Return Values
    The return value is the length, in characters, of the text. 
    Default Action
    The DefWindowProc function returns the length, in characters, of the text. Under certain conditions, this value may actually be greater than the length of the text. For more information, see the following Remarks section.
    Remarks
    For an edit control, the text to be copied is the content of the edit control. For a combo box, the text is the content of the edit control (or static-text) portion of the combo box. For a button, the text is the button name. For other windows, the text is the window title. To determine the length of an item in a list box, an application can use the LB_GETTEXTLEN message. 
    Under certain conditions, the DefWindowProc function returns a value that is larger than the actual length of the text. This occurs with certain mixtures of ANSI and Unicode, and is due to the system allowing for the possible existence of DBCS characters within the text. The return value, however, will always be at least as large as the actual length of the text; you can thus always use it to guide buffer allocation. This behavior can occur when an application uses both ANSI functions and common dialogs, which use Unicode. 
    To obtain the exact length of the text, use the WM_GETTEXT, LB_GETTEXT, or CB_GETLBTEXT messages, or the GetWindowText function.

    WM_PAINT = H000F;
    要求一个窗口重画自己
    An application sends the WM_PAINT message when the system or another application makes a request to paint a portion of an application's window. The message is sent when the UpdateWindow or RedrawWindow function is called, or by theDispatchMessage function when the application obtains a WM_PAINT message by using theGetMessage orPeekMessage function. 
    WM_PAINT 
    hdc = (HDC) wParam; // the device context to draw in
     Parameters
    hdc 
    Handle to the device context to draw in. If this parameter is NULL, use the default device context. This parameter is used by some common controls to enable drawing in a device context other than the default device context. Other windows can safely ignore this parameter. 
    Return Values
    An application returns zero if it processes this message. 
    Remarks
    The DefWindowProc function validates the update region. The function may also send the WM_NCPAINT message to the window procedure if the window frame must be painted and send theWM_ERASEBKGND message if the window background must be erased. 
    The system sends this message when there are no other messages in the application's message queue. DispatchMessage determines where to send the message; GetMessage determines which message to dispatch. GetMessage returns the WM_PAINT message when there are no other messages in the application's message queue, and DispatchMessage sends the message to the appropriate window procedure. 
    A window may receive internal paint messages as a result of calling RedrawWindow with the RDW_INTERNALPAINT flag set. In this case, the window may not have an update region. An application should call the GetUpdateRect function to determine whether the window has an update region. If GetUpdateRect returns zero, the application should not call the BeginPaint and EndPaint functions. 
    An application must check for any necessary internal painting by looking at its internal data structures for each WM_PAINT message, because a WM_PAINT message may have been caused by both a non-NULL update region and a call to RedrawWindow with the RDW_INTERNALPAINT flag set. 
    The system sends an internal WM_PAINT message only once. After an internal WM_PAINT message is returned from GetMessage or PeekMessage or is sent to a window by UpdateWindow, the system does not post or send further WM_PAINT messages until the window is invalidated or until RedrawWindow is called again with the RDW_INTERNALPAINT flag set. 
    For some common controls, the default WM_PAINT message processing checks the wParam parameter. If wParam is non-NULL, the control assumes that the value is an HDC and paints using that device context.

    WM_CLOSE = H0010;
    当一个窗口或应用程序要关闭时发送一个信号
    The WM_CLOSE message is sent as a signal that a window or an application should terminate. 
    WM_CLOSE  
    Parameters
    This message has no parameters. 
    Return Values
    If an application processes this message, it should return zero. 
    Default Action
    The DefWindowProc function calls the DestroyWindow function to destroy the window. 
    Remarks
    An application can prompt the user for confirmation, prior to destroying a window, by processing the WM_CLOSE message and calling the DestroyWindow function only if the user confirms the choice.

    WM_QUERYENDSESSION = H0011;
    当用户选择结束对话框或程序自己调用ExitWindows函数
    The WM_QUERYENDSESSION message is sent when the user chooses to end the session or when an application calls the ExitWindows function. If any application returns zero, the session is not ended. The system stops sending WM_QUERYENDSESSION messages as soon as one application returns zero. 
    After processing this message, the system sends the WM_ENDSESSION message with the wParam parameter set to the results of the WM_QUERYENDSESSION message. 
    WM_QUERYENDSESSION 
    nSource = (UINT) wParam;    // source of end-session request 
    fLogOff = lParam            // logoff flag 
     Parameters
    nSource 
    Reserved for future use. 
    fLogOff 
    Value of lParam. Indicates whether the user is logging off or shutting down the system. Supported values include: ENDSESSION_LOGOFF. 
    Return Values
    If an application can terminate conveniently, it should return TRUE; otherwise, it should return FALSE. 
    Remarks
    By default, the DefWindowProc function returns TRUE for this message. 
    Windows NT: When an application returns TRUE for this message, it receives the WM_ENDSESSION message and it is terminated, regardless of how the other applications respond to the WM_QUERYENDSESSION message. 
    Windows 95: After all applications return TRUE for this message, they receive the WM_ENDSESSION and they are terminated.

    WM_QUIT = H0012;
    用来结束程序运行或当程序调用postquitmessage函数 
    The WM_QUIT message indicates a request to terminate an application and is generated when the application calls the PostQuitMessage function. It causes the GetMessage function to return zero. 
    WM_QUIT 
    nExitCode = (int) wParam;   // exit code 
     Parameters
    nExitCode 
    Value of wParam. Specifies the exit code given in the PostQuitMessage function. 
    Return Values
    This message does not have a return value, because it causes the message loop to terminate before the message is sent to the application's window procedure.

    WM_QUERYOPEN = H0013;
    当用户窗口恢复以前的大小位置时,把此消息发送给某个图标
    The WM_QUERYOPEN message is sent to an icon when the user requests that the window be restored to its previous size and position. 
    WM_QUERYOPEN  
    Parameters
    This message has no parameters. 
    Return Values
    If the icon can be opened, an application that processes this message should return TRUE; otherwise, it should return FALSE to prevent the icon from being opened. 
    Default Action
    The DefWindowProc function returns TRUE. 
    Remarks
    While processing this message, the application should not perform any action that would cause an activation or focus change (for example, creating a dialog box).

    WM_ERASEBKGND = H0014;
    当窗口背景必须被擦除时(例在窗口改变大小时)
    An application sends the WM_ERASEBKGND message when the window background must be erased (for example, when a window is resized). The message is sent to prepare an invalidated portion of a window for painting. 
    WM_ERASEBKGND 
    hdc = (HDC) wParam; // handle to device context  
    Parameters
    hdc 
    Value of wParam. Handle to the device context. 
    Return Values
    An application should return nonzero if it erases the background; otherwise, it should return zero. 
    Remarks
    The DefWindowProc function erases the background by using the class background brush specified by the hbrBackground member of the WNDCLASS structure. If hbrBackground is NULL, the application should process the WM_ERASEBKGND message and erase the background. 
    An application should return nonzero in response to WM_ERASEBKGND if it processes the message and erases the background; this indicates that no further erasing is required. If the application returns zero, the window will remain marked for erasing. (Typically, this indicates that the fErase member of the PAINTSTRUCT structure will be TRUE.)

    WM_SYSCOLORCHANGE = H0015;
    当系统颜色改变时,发送此消息给所有顶级窗口
    The WM_SYSCOLORCHANGE message is sent to all top-level windows when a change is made to a system color setting. 
    WM_SYSCOLORCHANGE  
    Parameters
    This message has no parameters. 
    Remarks
    The system sends a WM_PAINT message to any window that is affected by a system color change. 
    Applications that have brushes using the existing system colors should delete those brushes and recreate them using the new system colors. 
    Top level windows that use common controls must forward the WM_SYSCOLORCHANGE message to the controls; otherwise, the controls will not be notified of the color change. This ensures that the colors used by your common controls are consistent with those used by other user interface objects. For example, a toolbar control uses the "3D Objects" color to draw its buttons. If the user changes the 3D Objects color but the WM_SYSCOLORCHANGE message is not forwarded to the toolbar, the toolbar buttons will remain in their original color while the color of other buttons in the system changes.

    WM_ENDSESSION = H0016;
    当系统进程发出WM_QUERYENDSESSION消息后,此消息发送给应用程序,通知它对话是否结束
    The WM_ENDSESSION message is sent to an application after the system processes the results of the WM_QUERYENDSESSION message. The WM_ENDSESSION message informs the application whether the session is ending. 
    WM_ENDSESSION 
    fEndSession = (BOOL) wParam;     // end-session flag 
    fLogOff =  lParam                // logoff flag  
    Parameters
    fEndSession 
    Value of wParam. Specifies whether the session is being ended. If the session is being ended, this parameter is TRUE; otherwise, it is FALSE. 
    fLogOff 
    Value of lParam. Indicates whether the user is logging off or shutting down the system. Supported values include: ENDSESSION_LOGOFF. 
    Return Values
    If an application processes this message, it should return zero. 
    Remarks
    If the fEndSession parameter is TRUE, the session can end any time after all applications have returned from processing this message. Therefore, an application should perform all tasks required for termination before returning from this message. 
    The application need not call the DestroyWindow or PostQuitMessage function when the session is ending.

    WM_SYSTEMERROR = H0017;

    WM_SHOWWINDOW = H0018;
    当隐藏或显示窗口是发送此消息给这个窗口
    The WM_SHOWWINDOW message is sent to a window when the window is about to be hidden or shown. 
    WM_SHOWWINDOW 
    fShow = (BOOL) wParam;      // show/hide flag 
    fnStatus = (int) lParam;    // status flag  
    Parameters
    fShow 
    Value of wParam. Specifies whether a window is being shown. It is TRUE if the window is being shown or FALSE if the window is being hidden. 
    fnStatus 
    Value of lParam. Specifies the status of the window being shown. The fnStatus parameter is zero if the message is sent because of a call to the ShowWindow function; otherwise, fnStatus is one of the following values: Value Meaning 
    SW_OTHERUNZOOM The window is being uncovered because a maximize window was restored or minimized. 
    SW_OTHERZOOM The window is being covered by another window that has been maximized. 
    SW_PARENTCLOSING The window's owner window is being minimized. 
    SW_PARENTOPENING The window's owner window is being restored. 
    Return Values
    If an application processes this message, it should return zero. 
    Default Action
    The DefWindowProc function hides or shows the window, as specified by the message. 
    Remarks
    If a window has the WS_VISIBLE style when it is created, the window receives this message after it is created, but before it is displayed. A window also receives this message when its visibility state is changed by the ShowWindow or ShowOwnedPopups function. 
    The WM_SHOWWINDOW message is not sent under the following circumstances: 
    When a top-level, overlapped window is created with the WS_MAXIMIZE or WS_MINIMIZE style. 
    When the SW_SHOWNORMAL flag is specified in the call to the ShowWindow function.

    WM_ACTIVATEAPP = H001C;
    发此消息给应用程序哪个窗口是激活的,哪个是非激活的;
    The WM_ACTIVATEAPP message is sent when a window belonging to a different application than the active window is about to be activated. The message is sent to the application whose window is being activated and to the application whose window is being deactivated. 
    WM_ACTIVATEAPP 
    fActive = (BOOL) wParam;        // activation flag 
    dwThreadID = (DWORD) lParam:    // thread identifier  
    Parameters
    fActive 
    Value of wParam. Specifies whether the window is being activated or deactivated. This parameter is TRUE if the window is being activated; it is FALSE if the window is being deactivated. 
    dwThreadID 
    Value of lParam. Specifies a thread identifier. If the fActive parameter is TRUE, dwThreadID is the identifier of the thread that owns the window being deactivated. If fActive is FALSE, dwThreadID is the identifier of the thread that owns the window being activated. 
    Return Values
    If an application processes this message, it should return zero.

    WM_FONTCHANGE = H001D;
    当系统的字体资源库变化时发送此消息给所有顶级窗口
    An application sends the WM_FONTCHANGE message to all top-level windows in the system after changing the pool of font resources. 
    WM_FONTCHANGE 
    wParam = 0; // not used, must be zero 
    lParam = 0; // not used, must be zero  
    Parameters
    This message has no parameters. 
    Remarks
    An application that adds or removes fonts from the system (for example, by using the AddFontResource or RemoveFontResource function) should send this message to all top-level windows. 
    To send the WM_FONTCHANGE message to all top-level windows, an application can call the SendMessage function with the hwnd parameter set to HWND_BROADCAST.

    WM_TIMECHANGE = H001E;
    当系统的时间变化时发送此消息给所有顶级窗口
    Windows NT 5.0 and later: An application should not broadcast this message, because the system will broadcast this message when the application changes the system time. 
    Windows NT 4.0 and earlier: An application should send the WM_TIMECHANGE message to all top-level windows after changing the system time. 
    Windows 95: An application should send the WM_TIMECHANGE message to all top-level windows after changing the system time. 
    WM_TIMECHANGE 
    wParam = 0; // not used, must be zero 
    lParam = 0; // not used, must be zero  
    Parameters
    This message has no parameters. 
    Return Values
    An application should return zero if it processes this message. 
    Remarks
    To send the WM_TIMECHANGE message to all top-level windows, an application can use the SendMessage function with the hwnd parameter set to HWND_TOPMOST.

    WM_CANCELMODE = H001F;
    发送此消息来取消某种正在进行的摸态(操作)
    The WM_CANCELMODE message is sent to cancel certain modes, such as mouse capture. For example, the system sends this message to the active window when a dialog box or message box is displayed. Certain functions also send this message explicitly to the specified window regardless of whether it is the active window. For example, the EnableWindow function sends this message when disabling the specified window. 
    WM_CANCELMODE  
    Parameters
    This message has no parameters. 
    Return Values
    If an application processes this message, it should return zero. 
    Default Action
    The DefWindowProc function cancels internal processing of standard scroll bar input, cancels internal menu processing, and releases the mouse capture.

    WM_SETCURSOR = H0020;
    如果鼠标引起光标在某个窗口中移动且鼠标输入没有被捕获时,就发消息给某个窗口
    The WM_SETCURSOR message is sent to a window if the mouse causes the cursor to move within a window and mouse input is not captured. 
    WM_SETCURSOR 
    hwnd = (HWND) wParam;       // handle to window with cursor 
    nHittest = LOWORD(lParam);  // hit-test code 
    wMouseMsg = HIWORD(lParam); // mouse-message identifier  
    Parameters
    hwnd 
    Value of wParam. Handle to the window that contains the cursor. 
    nHittest 
    Value of the low-order word of lParam. Specifies the hit-test code. 
    wMouseMsg 
    Value of the high-order word of lParam. Specifies the identifier of the mouse message. 
    Default Action
    The DefWindowProc function passes the WM_SETCURSOR message to a parent window before processing. If the parent window returns TRUE, further processing is halted. Passing the message to a window's parent window gives the parent window control over the cursor's setting in a child window. The DefWindowProc function also uses this message to set the cursor to an arrow if it is not in the client area, or to the registered class cursor if it is in the client area. If the low-order word of the lParam parameter is HTERROR and the high-order word of lParam specifies that one of the mouse buttons is pressed, DefWindowProc calls the MessageBeep function. 
    Remarks
    The high-order word of lParam is zero when the window enters menu mode.

    WM_MOUSEACTIVATE = H0021;
    当光标在某个非激活的窗口中而用户正按着鼠标的某个键发送此消息给当前窗口
    The WM_MOUSEACTIVATE message is sent when the cursor is in an inactive window and the user presses a mouse button. The parent window receives this message only if the child window passes it to the DefWindowProc function. 
    WM_MOUSEACTIVATE 
    hwndTopLevel = (HWND) wParam;       // handle of top-level parent 
    nHittest = (INT) LOWORD(lParam);    // hit-test value 
    uMsg =    (UINT) HIWORD(lParam);    // mouse message  
    Parameters
    hwndTopLevel 
    Value of wParam. Handle to the top-level parent window of the window being activated. 
    nHittest 
    Value of the low-order word of lParam. Specifies the hit-test value returned by the DefWindowProc function as a result of processing the WM_NCHITTEST message. For a list of hit-test values, see WM_NCHITTEST. 
    uMsg 
    Value of the high-order word of lParam. Specifies the identifier of the mouse message generated when the user pressed a mouse button. The mouse message is either discarded or posted to the window, depending on the return value. 
    Return Values
    The return value specifies whether the window should be activated and whether the identifier of the mouse message should be discarded. It must be one of the following values: 
    Value Meaning 
    MA_ACTIVATE Activates the window, and does not discard the mouse message. 
    MA_ACTIVATEANDEAT Activates the window, and discards the mouse message. 
    MA_NOACTIVATE Does not activate the window, and does not discard the mouse message. 
    MA_NOACTIVATEANDEAT Does not activate the window, but discards the mouse message. 
    Default Action
    The DefWindowProc function passes the message to a child window's parent window before any processing occurs. The parent window determines whether to activate the child window. If it activates the child window, the parent window should return MA_NOACTIVATE or MA_NOACTIVATEANDEAT to prevent the system from processing the message further.

    WM_CHILDACTIVATE = H0022;
    发送此消息给MDI子窗口当用户点击此窗口的标题栏,或当窗口被激活,移动,改变大小
    The WM_CHILDACTIVATE message is sent to a multiple document interface (MDI) child window when the user clicks the window's title bar or when the window is activated, moved, or sized. 
    WM_CHILDACTIVATE  
    Parameters
    This message has no parameters. 
    Return Values
    If an application processes this message, it should return zero.

    WM_QUEUESYNC = H0023;
    消息由基于计算机的训练程序发送,通过WH_JOURNALPALYBACK的hook程序分离出用户输入消息
    The WM_QUEUESYNC message is sent by a computer-based training (CBT) application to separate user-input messages from other messages sent through the WH_JOURNALPLAYBACK hook procedure. 
    WM_QUEUESYNC 
    wParam = 0; // not used, must be zero 
    lParam = 0; // not used, must be zero  
    Parameters
    This message has no parameters. 
    Return Values
    A CBT application should return zero if it processes this message. 
    Remarks
    Whenever a CBT application uses the WH_JOURNALPLAYBACK hook procedure, the first and last messages are WM_QUEUESYNC. This allows the CBT application to intercept and examine user-initiated messages without doing so for events that it sends. 
    If an application specifies a NULL window handle, the message is posted to the message queue of the active window.

    WM_GETMINMAXINFO = H0024;
    消息发送给窗口当它将要改变大小或位置;
    The WM_GETMINMAXINFO message is sent to a window when the size or position of the window is about to change. An application can use this message to override the window's default maximized size and position, or its default minimum or maximum tracking size. 
    WM_GETMINMAXINFO 
    lpmmi = (LPMINMAXINFO) lParam; // address of structure  
    Parameters
    lpmmi 
    Value of lParam. Pointer to a MINMAXINFO structure that contains the default maximized position and dimensions, and the default minimum and maximum tracking sizes. An application can override the defaults by setting the members of this structure. 
    Return Values
    If an application processes this message, it should return zero. 
    Remarks
    The maximum tracking size is the largest window size that can be produced by using the borders to size the window. The minimum tracking size is the smallest window size that can be produced by using the borders to size the window.

    WM_PAINTICON = H0026;
    发送给最小化窗口当它图标将要被重画
    The WM_PAINTICON message is sent to a minimized window when the icon is to be painted but only if the application is written for 16-bit Windows. A window receives this message only if a class icon is defined for the window; otherwise,WM_PAINT is sent instead. 
    WM_PAINTICON  
    Parameters
    This message has no parameters. 
    Return Values
    An application should return zero if it processes this message. 
    Remarks
    The DefWindowProc function draws the class icon. For compatibility with 16-bit Windows, wParam is TRUE. However, this value has no significance.

    WM_ICONERASEBKGND = H0027;
    消息发送给某个最小化窗口,仅当它在画图标前它的背景必须被重画
    The WM_ICONERASEBKGND message is sent to a minimized window when the background of the icon must be filled before painting the icon. A window receives this message only if a class icon is defined for the window; otherwise, WM_ERASEBKGND is sent. 
    WM_ICONERASEBKGND 
    hdc = (HDC) wParam; // handle to device context  
    Parameters
    hdc 
    Value of wParam. Handle to the device context of the icon. 
    Return Values
    An application should return nonzero if it processes this message. 
    Remarks
    The DefWindowProc function fills the icon background with the class background brush of the parent window.

    WM_NEXTDLGCTL = H0028;
    发送此消息给一个对话框程序去更改焦点位置
    The WM_NEXTDLGCTL message is sent to a dialog box procedure to set the keyboard focus to a different control in the dialog box. 
    WM_NEXTDLGCTL 
    wCtlFocus = wParam;              // identifies control for focus 
    fHandle = (BOOL) LOWORD(lParam); // wParam handle flag  
    Parameters
    wCtlFocus 
    Value of wParam. If the fHandle parameter is TRUE, the wCtlFocus parameter identifies the control that receives the focus. If fHandle is FALSE, wCtlFocus is a flag that indicates whether the next or previous control with the WS_TABSTOP style receives the focus. If wCtlFocus is zero, the next control receives the focus; otherwise, the previous control with the WS_TABSTOP style receives the focus. 
    fHandle 
    Value of lParam. Contains a flag that indicates how the system uses the wCtlFocus parameter. If the fHandle parameter is TRUE, wCtlFocus is a handle associated with the control that receives the focus; otherwise, wCtlFocus is a flag that indicates whether the next or previous control with the WS_TABSTOP style receives the focus. 
    Return Values
    An application should return zero if it processes this message. 
    Remarks
    The effect of this message differs from that of the SetFocus function because WM_NEXTDLGCTL modifies the border around the control. 
    Do not use the SendMessage function to send a WM_NEXTDLGCTL message if your application will concurrently process other messages that set the focus. Use the PostMessage function instead.

    WM_SPOOLERSTATUS = H002A;
    每当打印管理列队增加或减少一条作业时发出此消息 
    The WM_SPOOLERSTATUS message is sent from Print Manager whenever a job is added to or removed from the Print Manager queue. 
    WM_SPOOLERSTATUS 
    fwJobStatus = wParam;       // job-status flag 
    cJobsLeft = LOWORD(lParam); // number of jobs remaining  
    Parameters
    fwJobStatus 
    Value of wParam. Specifies the PR_JOBSTATUS flag. 
    cJobsLeft 
    Value of the low-order word of lParam. Specifies the number of jobs remaining in the Print Manager queue. 
    Return Values
    An application should return zero if it processes this message. 
    Remarks
    This message is for informational purposes only.

    WM_DRAWITEM = H002B;
    当button,combobox,listbox,menu的可视外观改变时发送此消息给这些空件的所有者
    The WM_DRAWITEM message is sent to the owner window of an owner-drawn button, combo box, list box, or menu when a visual aspect of the button, combo box, list box, or menu has changed. 
    WM_DRAWITEM 
    idCtl = (UINT) wParam;             // control identifier 
    lpdis = (LPDRAWITEMSTRUCT) lParam; // item-drawing information  
    Parameters
    idCtl 
    Value of wParam. Specifies the identifier of the control that sent the WM_DRAWITEM message. If the message was sent by a menu, this parameter is zero. 
    lpdis 
    Value of lParam. Pointer to a DRAWITEMSTRUCT structure containing information about the item to be drawn and the type of drawing required. 
    Return Values
    If an application processes this message, it should return TRUE. 
    Default Action
    The DefWindowProc function draws the focus rectangle for an owner-drawn list box item. 
    Remarks
    The itemAction member of the DRAWITEMSTRUCT structure specifies the drawing operation that an application should perform. 
    Before returning from processing this message, an application should ensure that the device context identified by the hDC member of the DRAWITEMSTRUCT structure is in the default state.

    WM_MEASUREITEM = H002C;
    当button, combo box, list box, list view control, or menu item 被创建时发送此消息给控件的所有者
    The WM_MEASUREITEM message is sent to the owner window of an owner-drawn button, combo box, list box, list view control, or menu item when the control or menu is created. 
    WM_MEASUREITEM 
    idCtl = (UINT) wParam;                // control identifier 
    lpmis = (LPMEASUREITEMSTRUCT) lParam; // item-size information  
    Parameters
    idCtl 
    Value of wParam. Contains the value of the CtlID member of the MEASUREITEMSTRUCT structure pointed to by the lpmis parameter. This value identifies the control that sent the WM_MEASUREITEM message. 
    If the value is zero, the message was sent by a menu. If the value is nonzero, the message was sent by a combo box or by a list box. If the value is nonzero, and the value of the itemID member of the MEASUREITEMSTRUCT pointed to by lpmis is (UINT) –1, the message was sent by a combo edit field. 
    lpmis 
    Value of lParam. Pointer to a MEASUREITEMSTRUCT structure that contains the dimensions of the owner-drawn control or menu item. 
    Return Values
    If an application processes this message, it should return TRUE. 
    Remarks
    When the owner window receives the WM_MEASUREITEM message, the owner fills in the MEASUREITEMSTRUCT structure pointed to by the lParam parameter of the message and returns; this informs the system of the dimensions of the control. If a list box or combo box is created with the LBS_OWNERDRAWVARIABLE or CBS_OWNERDRAWVARIABLE style, this message is sent to the owner for each item in the control; otherwise, this message is sent once. 
    The system sends the WM_MEASUREITEM message to the owner window of combo boxes and list boxes created with the OWNERDRAWFIXED style before sending the WM_INITDIALOG message. As a result, when the owner receives this message, the system has not yet determined the height and width of the font used in the control; function calls and calculations requiring these values should occur in the main function of the application or library.

    WM_DELETEITEM = H002D;
    当the list box 或 combo box 被销毁或 当 某些项被删除通过LB_DELETESTRING, LB_RESETCONTENT, CB_DELETESTRING, or CB_RESETCONTENT 消息
    The WM_DELETEITEM message is sent to the owner of a list box or combo box when the list box or combo box is destroyed or when items are removed by the LB_DELETESTRING, LB_RESETCONTENT, CB_DELETESTRING, or CB_RESETCONTENT message. The system sends a WM_DELETEITEM message for each deleted item. The system sends the WM_DELETEITEM message for any deleted list box or combo box item with nonzero item data.
    WM_DELETEITEM 
    idCtl = wParam;                      // control identifier 
    lpdis = (LPDELETEITEMSTRUCT) lParam; // structure with item information  
    Parameters
    idCtl 
    Value of wParam. Specifies the identifier of the control that sent the WM_DELETEITEM message. 
    lpdis 
    Value of lParam. Pointer to a DELETEITEMSTRUCT structure that contains information about the item deleted from a list box. 
    Return Values
    An application should return TRUE if it processes this message.

    WM_VKEYTOITEM = H002E;
    消息有一个LBS_WANTKEYBOARDINPUT风格的发出给它的所有者来响应WM_KEYDOWN消息 
    The WM_VKEYTOITEM message is sent by a list box with the LBS_WANTKEYBOARDINPUT style to its owner in response to a WM_KEYDOWN message. 
    WM_VKEYTOITEM 
    vkey = LOWORD(wParam);      // virtual-key code 
    nCaretPos = HIWORD(wParam); // caret position 
    hwndLB = lParam;            // handle to list box  
    Parameters
    vkey 
    Value of the low-order word of wParam. Specifies the virtual-key code of the key the user pressed. 
    nCaretPos 
    Value of the high-order word of wParam. Specifies the current position of the caret. 
    hwndLB 
    Value of lParam. Handle to the list box. 
    Return Values
    The return value specifies the action that the application performed in response to the message. A return value of –2 indicates that the application handled all aspects of selecting the item and requires no further action by the list box. A return value of –1 indicates that the list box should perform the default action in response to the keystroke. A return value of 0 or greater specifies the index of an item in the list box and indicates that the list box should perform the default action for the keystroke on the given item. 
    Default Action
    The DefWindowProc function returns –1. 
    Remarks
    If a dialog box procedure handles this message, it should cast the desired return value to a BOOL and return the value directly. The DWL_MSGRESULT value set by the SetWindowLong function is ignored.

    WM_CHARTOITEM = H002F;
    消息由一个LBS_WANTKEYBOARDINPUT风格的列表框发送给他的所有者来响应WM_CHAR消息 
    The WM_CHARTOITEM message is sent by a list box with the LBS_WANTKEYBOARDINPUT style to its owner in response to a WM_CHAR message. 
    WM_CHARTOITEM 
    nKey = LOWORD(wParam);          // key value 
    nCaretPos = HIWORD(wParam);     // caret position 
    hwndListBox = (HWND) lParam;    // handle to list box  
    Parameters
    nKey 
    Value of the low-order word of wParam. Specifies the value of the key the user pressed. 
    nCaretPos 
    Value of the high-order word of wParam. Specifies the current position of the caret. 
    hwndListBox 
    Value of lParam. Handle to the list box. 
    Return Values
    The return value specifies the action that the application performed in response to the message. A return value of –1 or –2 indicates that the application handled all aspects of selecting the item and requires no further action by the list box. A return value of 0 or greater specifies the zero-based index of an item in the list box and indicates that the list box should perform the default action for the keystroke on the given item. 
    Default Action
    The DefWindowProc function returns –1. 
    Remarks
    Only owner-drawn list boxes that do not have the LBS_HASSTRINGS style can receive this message. 
    If a dialog box procedure handles this message, it should cast the desired return value to a BOOL and return the value directly. The DWL_MSGRESULT value set by the SetWindowLong function is ignored.

    WM_SETFONT = H0030;
    当绘制文本时程序发送此消息得到控件要用的颜色 
    An application sends a WM_SETFONT message to specify the font that a control is to use when drawing text. 
    WM_SETFONT 
    wParam = (WPARAM) hfont;            // handle of font 
    lParam = MAKELPARAM(fRedraw, 0);    // redraw flag  
    Parameters
    hfont 
    Value of wParam. Handle to the font. If this parameter is NULL, the control uses the default system font to draw text. 
    fRedraw 
    Value of lParam. Specifies whether the control should be redrawn immediately upon setting the font. Setting the fRedraw parameter to TRUE causes the control to redraw itself. 
    Return Values
    This message does not return a value. 
    Remarks
    The WM_SETFONT message applies to all controls, not just those in dialog boxes. 
    The best time for the owner of a dialog box control to set the font of the control is when it receives the WM_INITDIALOG message. The application should call theDeleteObject function to delete the font when it is no longer needed; for example, after it destroys the control. 
    The size of the control does not change as a result of receiving this message. To avoid clipping text that does not fit within the boundaries of the control, the application should correct the size of the control window before it sets the font. 
    When a dialog box uses the DS_SETFONT style to set the text in its controls, the system sends the WM_SETFONT message to the dialog box procedure before it creates the controls. An application can create a dialog box that contains the DS_SETFONT style by calling any of the following functions: 
    CreateDialogIndirect 、CreateDialogIndirectParam 、DialogBoxIndirect 、DialogBoxIndirectParam

    WM_GETFONT = H0031;
    应用程序发送此消息得到当前控件绘制文本的字体
    An application sends a WM_GETFONT message to a control to retrieve the font with which the control is currently drawing its text. 
    WM_GETFONT 
    wParam = 0; // not used, must be zero 
    lParam = 0; // not used, must be zero  
    Parameters
    This message has no parameters. 
    Return Values
    The return value is a handle to the font used by the control, or NULL if the control is using the system font.

    WM_SETHOTKEY = H0032;
    应用程序发送此消息让一个窗口与一个热键相关连
    An application sends a WM_SETHOTKEY message to a window to associate a hot key with the window. When the user presses the hot key, the system activates the window. 
    WM_SETHOTKEY 
    wParam = (WPARAM) MAKEWORD(vkey, modifiers)   // virtual-key code and modifiers of hot key 
    lParam = 0;                                   // not used; must be zero  
    Parameters
    vkey 
    Value of wParam. Specifies the virtual-key code and modifiers of the hot key to associate with the window. The virtual-key code is in the low byte of the parameter and the modifier flags are in the high byte. Setting this parameter to NULL removes the hot key associated with a window. The modifier byte can be a combination of the following flags. Value Meaning 
    HOTKEYF_ALT ALT key 
    HOTKEYF_CONTROL CTRL key 
    HOTKEYF_EXT Extended key 
    HOTKEYF_SHIFT SHIFT key 
    Return Values
    The return value is one of the following: 
    Value Meaning 
    –1 The function is unsuccessful — the hot key is invalid. 
    ..0 The function is unsuccessful — the window is invalid. 
    ..1 The function is successful, and no other window has the same hot key. 
    ..2 The function is successful, but another window already has the same hot key. 
    Remarks
    A hot key cannot be associated with a child window. 
    VK_ESCAPE, VK_SPACE, and VK_TAB are invalid hot keys. 
    When the user presses the hot key, the system generates a WM_SYSCOMMAND message with wParam equal to SC_HOTKEY and lParam equal to the window's handle. If this message is passed on to DefWindowProc, the system will bring the window's last active popup (if it exists) or the window itself (if there is no popup window) to the foreground.
    A window can only have one hot key. If the window already has a hot key associated with it, the new hot key replaces the old one. If more than one window has the same hot key, the window that is activated by the hot key is random. 
    These hot keys are unrelated to the hot keys set by RegisterHotKey.

    WM_GETHOTKEY = H0033;
    应用程序发送此消息来判断热键与某个窗口是否有关联
    An application sends a WM_GETHOTKEY message to determine the hot key associated with a window. 
    WM_GETHOTKEY 
    wParam = 0; // not used; must be zero 
    lParam = 0; // not used; must be zero  
    Parameters
    This message has no parameters. 
    Return Values
    The return value is the virtual-key code and modifiers for the hot key, or NULL if no hot key is associated with the window. The virtual-key code is in the low byte of the return value and the modifiers are in the high byte. The modifiers can be a combination of the following flags.
    Value Meaning 
    HOTKEYF_ALT ALT key 
    HOTKEYF_CONTROL CTRL key 
    HOTKEYF_EXT Extended key 
    HOTKEYF_SHIFT SHIFT key 
    Remarks
    These hot keys are unrelated to the hot keys set by the RegisterHotKey function.

    WM_QUERYDRAGICON = H0037;
    消息发送给最小化窗口,当此窗口将要被拖放而它的类中没有定义图标,应用程序能返回一个图标或光标的句柄,当用户拖放图标时系统显示这个图标或光标
    The WM_QUERYDRAGICON message is sent to a minimized (iconic) window. The window is about to be dragged by the user but does not have an icon defined for its class. An application can return a handle to an icon or cursor. The system displays this cursor or icon while the user drags the icon. 
    WM_QUERYDRAGICON  
    Parameters
    This message has no parameters. 
    Return Values
    An application should return a handle to a cursor or icon that the system is to display while the user drags the icon. The cursor or icon must be compatible with the display driver's resolution. If the application returns NULL, the system displays the default cursor. 
    Default Action
    The DefWindowProc function returns a handle to the default cursor. 
    Remarks
    When the user drags the icon of a window without a class icon, the system replaces the icon with a default cursor. If the application requires a different cursor to be displayed during dragging, it must return a handle to the cursor or icon compatible with the display driver's resolution. If an application returns a handle to a color cursor or icon, the system converts the cursor or icon to black and white. The application can call the LoadCursor or LoadIcon function to load a cursor or icon from the resources in its executable (.EXE) file and to retrieve this handle. 
    If a dialog box procedure handles this message, it should cast the desired return value to a BOOL and return the value directly. The DWL_MSGRESULT value set by the SetWindowLong function is ignored.

    WM_COMPAREITEM = H0039;
    发送此消息来判定combobox或listbox新增加的项的相对位置
    The system sends the WM_COMPAREITEM message to determine the relative position of a new item in the sorted list of an owner-drawn combo box or list box. Whenever the application adds a new item, the system sends this message to the owner of a combo box or list box created with the CBS_SORT or LBS_SORT style. 
    WM_COMPAREITEM 
    idCtl = wParam;                       // control identifier 
    lpcis = (LPCOMPAREITEMSTRUCT) lParam; // structure with items  
    Parameters
    idCtl 
    Value of wParam. Specifies the identifier of the control that sent the WM_COMPAREITEM message. 
    lpcis 
    Value of lParam. Pointer to a COMPAREITEMSTRUCT structure that contains the identifiers and application-supplied data for two items in the combo or list box. 
    Return Values
    The return value indicates the relative position of the two items. It may be any of the following: 
    Value Meaning 
    –1 Item 1 precedes item 2 in the sorted order. 
    0 Items 1 and 2 are equivalent in the sorted order. 
    1 Item 1 follows item 2 in the sorted order. 
    Remarks
    When the owner of an owner-drawn combo box or list box receives this message, the owner returns a value indicating which of the items specified by the COMPAREITEMSTRUCT structure will appear before the other. Typically, the system sends this message several times until it determines the exact position for the new item. 
    If a dialog box procedure handles this message, it should cast the desired return value to a BOOL and return the value directly. The DWL_MSGRESULT value set by the SetWindowLong function is ignored.

    WM_GETOBJECT = H003D;
    The oleacc.dll dynamic link library sends this message to an Active Accessibility server application to retrieve information about an accessible object it contains. 
    wParam = (WPARAM)(DWORD) dwFlags;
    lParam = (LPARAM)(DWORD) dwObjId; 
    Parameters
    dwFlags 
    Flag values providing additional information about the message. This value is passed to the LresultFromObject function, as the wParam parameter. 
    dwObjId 
    Object identifier. This value can be one of the object identifier constants or a custom object identifier. 
    Return Values
    Returns a value specifying the object's reference, a request for a standard object, or a COM error code otherwise. To return an object reference, use the LresultFromObject function. To request a standard accessible object, return zero. To fail the message, return a COM error code.

    WM_COMPACTING = H0041;
    显示内存已经很少了
    The WM_COMPACTING message is sent to all top-level windows when the system detects more than 12.5 percent of system time over a 30- to 60-second interval is being spent compacting memory. This indicates that system memory is low. 
    WM_COMPACTING 
    wCompactRatio = wParam; // compacting ratio  
    Parameters
    wCompactRatio 
    Value of wParam. Specifies the ratio of central processing unit (CPU) time currently spent by the system compacting memory to CPU time currently spent by the system performing other operations. For example, 0x8000 represents 50 percent of CPU time spent compacting memory. 
    Return Values
    If an application processes this message, it should return zero. 
    Remarks
    When an application receives this message, it should free as much memory as possible, taking into account the current level of activity of the application and the total number of applications running on the system.

    WM_WINDOWPOSCHANGING = H0046;
    发送此消息给那个窗口的大小和位置将要被改变时,来调用setwindowpos函数或其它窗口管理函数
    The WM_WINDOWPOSCHANGING message is sent to a window whose size, position, or place in the Z order is about to change as a result of a call to the SetWindowPos function or another window-management function. 
    WM_WINDOWPOSCHANGING 
    lpwp = (LPWINDOWPOS) lParam; // points to size and position data  
    Parameters
    lpwp 
    Value of lParam. Pointer to a WINDOWPOS structure that contains information about the window's new size and position. 
    Return Values
    If an application processes this message, it should return zero. 
    Default Action
    For a window with the WS_OVERLAPPED or WS_THICKFRAME style, the DefWindowProc function sends the WM_GETMINMAXINFO message to the window. This is done to validate the new size and position of the window and to enforce the CS_BYTEALIGNCLIENT and CS_BYTEALIGNWINDOW client styles. By not passing the WM_WINDOWPOSCHANGING message to the DefWindowProc function, an application can override these defaults. 
    Remarks
    While this message is being processed, modifying any of the values in WINDOWPOS affects the window's new size, position, or place in the Z order. An application can prevent changes to the window by setting or clearing the appropriate bits in the flags member of WINDOWPOS.

    WM_WINDOWPOSCHANGED = H0047;
    发送此消息给那个窗口的大小和位置已经被改变时,来调用setwindowpos函数或其它窗口管理函数
    The WM_WINDOWPOSCHANGED message is sent to a window whose size, position, or place in the Z order has changed as a result of a call to the SetWindowPos function or another window-management function. 
    WM_WINDOWPOSCHANGED 
    lpwp = (LPWINDOWPOS) lParam; // points to size and position data  
    Parameters
    lpwp 
    Value of lParam. Pointer to a WINDOWPOS structure that contains information about the window's new size and position. 
    Return Values
    If an application processes this message, it should return zero. 
    Default Action
    The DefWindowProc function sends the WM_SIZE and WM_MOVE messages to the window. 
    Remarks
    The WM_SIZE and WM_MOVE messages are not sent if an application handles the WM_WINDOWPOSCHANGED message without calling DefWindowProc. It is more efficient to perform any move or size change processing during the WM_WINDOWPOSCHANGED message without calling DefWindowProc.

    WM_POWER = H0048;(适用于16位的windows)
    当系统将要进入暂停状态时发送此消息
    The WM_POWER message is sent when the system, typically a battery-powered personal computer, is about to enter suspended mode. 
    The WM_POWER message is obsolete. It is provided to simplify porting of 16-bit Windows-based applications. New Win32-based applications should use the WM_POWERBROADCAST message.
    WM_POWER 
    fwPowerEvt = wParam;    // power-event notification message  
    Parameters
    fwPowerEvt 
    Value of wParam. Specifies a power-event notification message. This parameter can be one of the following values: Value Meaning 
    PWR_CRITICALRESUME Indicates that the system is resuming operation after entering suspended mode without first sending a PWR_SUSPENDREQUEST notification message to the application. An application should perform any necessary recovery actions. 
    PWR_SUSPENDREQUEST Indicates that the system is about to enter suspended mode. 
    PWR_SUSPENDRESUME Indicates that the system is resuming operation after having entered suspended mode normally — that is, the system sent a PWR_SUSPENDREQUEST notification message to the application before the system was suspended. An application should perform any necessary recovery actions. 
    Return Values
    The value an application returns depends on the value of the wParam parameter. If wParam is PWR_SUSPENDREQUEST, the return value is PWR_FAIL to prevent the system from entering the suspended state; otherwise, it is PWR_OK. If wParam is PWR_SUSPENDRESUME or PWR_CRITICALRESUME, the return value is zero.

    WM_COPYDATA = H004A;
    当一个应用程序传递数据给另一个应用程序时发送此消息
    The WM_COPYDATA message is sent when an application passes data to another application. 
    WM_COPYDATA 
    wParam = (WPARAM) (HWND) hwnd;            // handle of sending window 
    lParam = (LPARAM) (PCOPYDATASTRUCT) pcds; // pointer to structure with data  
    Parameters
    hwnd 
    Handle to the window passing the data. 
    pcds 
    Pointer to a COPYDATASTRUCT structure that contains the data to be passed. 
    Return Values
    If the receiving application processes this message, it should return TRUE; otherwise, it should return FALSE. 
    Remarks
    An application must use theSendMessage function to send this message, not thePostMessage function.
    The data being passed must not contain pointers or other references to objects not accessible to the application receiving the data. 
    While this message is being sent, the referenced data must not be changed by another thread of the sending process. 
    The receiving application should consider the data read-only. The pcds parameter is valid only during the processing of the message. The receiving application should not free the memory referenced by pcds. If the receiving application must access the data after SendMessage returns, it must copy the data into a local buffer.

    WM_CANCELJOURNAL = H004B;
    当某个用户取消程序日志激活状态,提交此消息给程序
    The WM_CANCELJOURNAL message is posted to an application when a user cancels the application's journaling activities. The message is posted with a NULL window handle. 
    WM_CANCELJOURNAL 
    wParam = 0; // not used, must be zero 
    lParam = 0; // not used, must be zero  
    Parameters
    This message has no parameters. 
    Return Values
    This message does not return a value. It is meant to be processed from within an application's main loop or aGetMessage hook procedure, not from a window procedure. 
    Remarks
    Journal record and playback modes are modes imposed on the system that let an application sequentially record or play back user input. The system enters these modes when an application installs a JournalRecordProc or JournalPlaybackProc hook procedure. When the system is in either of these journaling modes, applications must take turns reading input from the input queue. If any one application stops reading input while the system is in a journaling mode, other applications are forced to wait. 
    To ensure a robust system, one that cannot be hung up by any one application, the system automatically cancels any journaling activities when a user presses CTRL+ESC or CTRL+ALT+DEL. The system then unhooks any journaling hook procedures, and posts a WM_CANCELJOURNAL message, with a NULL window handle, to the application that set the journaling hook. 
    Since the WM_CANCELJOURNAL has a NULL window handle, it cannot be dispatched to a window procedure. There are two ways for an application to see a WM_CANCELJOURNAL message: If the application is running in its own main loop, it must catch the message between its call toGetMessage orPeekMessage and its call toDispatchMessage. If the application is not running in its own main loop, it must set a GetMsgProc hook procedure (via a call to SetWindowsHookEx specifying the WH_GETMESSAGE hook type) that watches for the message. 
    When an application sees a WM_CANCELJOURNAL message, it can assume two things: the user has intentionally cancelled the journal record or playback mode, and the system has already unhooked any journal record or playback hook procedures. 
    Note that the key combinations mentioned above (CTRL+ESC or CTRL+ALT+DEL) cause the system to cancel journaling. If any one application is hung, they give the user a means of recovery. The VK_CANCEL virtual keycode (usually implemented as the CTRL+BREAK key combination) is what an application that is in journal record mode should watch for as a signal that the user wishes to cancel the journaling activity. The difference is that watching for VK_CANCEL is a suggested behavior for journaling applications, whereas CTRL+ESC or CTRL+ALT+DEL cause the system to cancel journalling regardless of a journalling application's behavior.

    WM_NOTIFY = H004E;
    当某个控件的某个事件已经发生或这个控件需要得到一些信息时,发送此消息给它的父窗口
    WM_NOTIFY
    WM_NOTIFY 
    idCtrl = (int) wParam; 
    pnmh = (LPNMHDR) lParam; 
    Sent by a common control to its parent window when an event has occurred in the control or the control requires some kind of information. 
    The return value is ignored except for notification messages that specify otherwise. 
    idCtrl 
    Identifier of the common control sending the message. This identifier is not guaranteed(保证) to be unique. An application should use the hwndFrom or idFrom member of the NMHDR structure (passed as the lParam parameter) to identify the control. 
    pnmh 
    Address of an NMHDR structure that contains the notification code and additional information. For some notification messages, this parameter points to a larger structure that has the NMHDR structure as its first member. 
    Not all controls will send WM_NOTIFY messages. In particular(特别), the standard Windows controls (edit controls, combo boxes, list boxes, buttons, scroll bars, and static controls) do not send WM_NOTIFY messages. Consult(参考) the documentation for the control to determine if it will send any WM_NOTIFY messages and, if it will, which notification codes it will send.

    WM_INPUTLANGCHANGEREQUEST = H0050;
    当用户选择某种输入语言,或输入语言的热键改变
    The WM_INPUTLANGCHANGEREQUEST message is posted to the window with the focus when the user chooses a new input language, either with the hotkey (specified in the Keyboard control panel application) or from the indicator on the system taskbar. An application can accept the change by passing the message to the DefWindowProc function or reject the change (and prevent it from taking place) by returning immediately.
    WM_INPUTLANGCHANGEREQUEST
    fSysCharSet = (BOOL) wParam 
    hkl = (HKL) lParam;  
    Parameters
    wParam 
    The lowest bit of this parameter is set if the handle to the keyboard layout can be used with the system character set. The other bits are reserved. 
    hkl 
    Handle to the new keyboard layout. 
    Return Values
    This message is posted, not sent, to the application, so the return value is ignored. To accept the change, the application should pass the message to DefWindowProc. To reject the change, the application should return zero without calling DefWindowProc.
    Default Action
    When the DefWindowProc function receives the WM_INPUTLANGCHANGEREQUEST message, it activates the new input locale and notifies the application of the change by sending the WM_INPUTLANGCHANGE message. 
    Remarks
    The language indicator is only present on the taskbar if you have installed more than one keyboard layout and if you have enabled the indicator using the Keyboard control panel application.

    WM_INPUTLANGCHANGE = H0051;
    当平台现场已经被改变后发送此消息给受影响的最顶级窗口
    The WM_INPUTLANGCHANGE message is sent to the topmost affected window after an application's input language has been changed. You should make any application-specific settings and pass the message to the DefWindowProc function, which passes the message to all first-level child windows. These child windows can pass the message to DefWindowProc to have it pass the message to their child windows, and so on. 
    WM_INPUTLANGCHANGE
    charset = wParam;
    hkl = (HKL) lParam;  
    Parameters
    charset 
    Specifies the character set of the new keyboard layout. 
    hkl 
    Handle to the new keyboard layout. 
    Return Values
    An application should return nonzero if it processes this message.

    WM_TCARD = H0052;
    当程序已经初始化windows帮助例程时发送此消息给应用程序
    WM_TCARD 
    idAction = wParam; 
    dwActionData = lParam; 
    Sent to an application that has initiated a training card with Windows Help. The message informs the application when the user clicks an authorable button. An application initiates a training card by specifying the HELP_TCARD command in a call to the WinHelp function. 
    The return value is ignored; use zero. 
    idAction 
    Value that indicates the action the user has taken. This can be one of these values: IDABORT The user clicked an authorable Abort button. 
    IDCANCEL The user clicked an authorable Cancel button. 
    IDCLOSE The user closed the training card. 
    IDHELP The user clicked an authorable Windows Help button. 
    IDIGNORE The user clicked an authorable Ignore button. 
    IDOK The user clicked an authorable OK button. 
    IDNO The user clicked an authorable No button. 
    IDRETRY The user clicked an authorable Retry button. 
    HELP_TCARD_DATA The user clicked an authorable button. The lParam parameter contains a long integer specified by the Help author. 
    HELP_TCARD_NEXT The user clicked an authorable Next button. 
    HELP_TCARD_OTHER_CALLER Another application has requested training cards. 
    IDYES The user clicked an authorable Yes button. 
    dwActionData 
    If idAction specifies HELP_TCARD_DATA, this parameter is a long integer specified by the Help author. Otherwise, this parameter is zero.

    WM_HELP = H0053;
    消息显示用户按下了F1,如果某个菜单是激活的,就发送此消息个此窗口关联的菜单,否则就发送给有焦点的窗口,如果当前都没有焦点,就把此消息发送给当前激活的窗口
    Indicates that the user pressed the F1 key. If a menu is active when F1 is pressed, WM_HELP is sent to the window associated with the menu; otherwise, WM_HELP is sent to the window that has the keyboard focus. If no window has the keyboard focus, WM_HELP is sent to the currently active window. 
    Syntax 
    WM_HELP 
    lphi = (LPHELPINFO) lParam; 
    Parameters
    lphi 
    Address of a HELPINFO structure that contains information about the menu item, control, dialog box, or window for which Help is requested. 
    Return Values
    Returns TRUE.
    Remarks
    TheDefWindowProc function passes WM_HELP to the parent window of a child window or to the owner of a top-level window.

    WM_USERCHANGED = H0054;
    当用户已经登入或退出后发送此消息给所有的窗口,当用户登入或退出时系统更新用户的具体设置信息,在用户更新设置时系统马上发送此消息
    The WM_USERCHANGED message is sent to all windows after the user has logged on or off. When the user logs on or off, the system updates the user-specific settings. The system sends this message immediately after updating the settings. 
    WM_USERCHANGED 
    wParam = 0;       // not used, must be zero 
    lParam = 0;       // not used, must be zero  
    Return Values
    An application should return zero if it processes this message.

    WM_NOTIFYFORMAT = H0055;
    公用控件,自定义控件和他们的父窗口通过此消息来判断控件是使用ANSI还是UNICODE结构在WM_NOTIFY消息,使用此控件能使某个控件与它的父控件之间进行相互通信
    WM_NOTIFYFORMAT
    hwndFrom = (HWND) wParam; 
    Command = lParam; 
    Used to determine if a window accepts ANSI or Unicode structures in the WM_NOTIFY notification message. WM_NOTIFYFORMAT messages are sent from a common control to its parent window and from the parent window to the common control. 
    Returns one of the following: NFR_ANSI  ANSI structures should be used in WM_NOTIFY messages sent by the control. 
    NFR_UNICODE  Unicode structures should be used in WM_NOTIFY messages sent by the control.  
    0  An error occurred. 
    If Command is NF_REQUERY, the return value is the result of the requery operation. 
    hwndFrom 
    Handle to the window that is sending the WM_NOTIFYFORMAT message. If Command is NF_QUERY, this parameter is the handle to a control. If Command is NF_REQUERY, this parameter is the handle to the parent window of a control. 
    Command 
    Command value that specifies the nature of the WM_NOTIFYFORMAT message. This will be one of the following values: NF_QUERY  The message is a query to determine whether ANSI or Unicode structures should be used in WM_NOTIFY messages. This command is sent from a control to its parent window during the creation of a control and in response to an NF_REQUERY command. 
    NF_REQUERY  The message is a request for a control to send an NF_QUERY form of this message to its parent window. This command is sent from the parent window. The parent window is asking the control to requery it about the type of structures to use in WM_NOTIFY messages. 
    When a common control is created, the control sends a WM_NOTIFYFORMAT message to its parent window to determine the type of structures to use in WM_NOTIFY messages. If the parent window does not handle this message, theDefWindowProc function responds according to the type of the parent window. That is, if the parent window is a Unicode window, DefWindowProc returns NFR_UNICODE, and if the parent window is an ANSI window, DefWindowProc returns NFR_ANSI. If the parent window is a dialog box and does not handle this message, theDefDlgProc function similarly responds according to the type of the dialog box (Unicode or ANSI). 
    A parent window can change the type of structures a common control uses in WM_NOTIFY messages by setting lParam to NF_REQUERY and sending a WM_NOTIFYFORMAT message to the control. This causes the control to send an NF_QUERY form of the WM_NOTIFYFORMAT message to the parent window. 
    Not all controls will send WM_NOTIFYFORMAT messages. In particular, the standard Windows controls (edit controls, combo boxes, list boxes, buttons, scroll bars, and static controls) do not send WM_NOTIFYFORMAT messages. Consult the documentation for the control to determine if it will send the WM_NOTIFYFORMAT message.

    WM_CONTEXTMENU = H007B;
    当用户某个窗口中点击了一下右键就发送此消息给这个窗口
    The WM_CONTEXTMENU message notifies a window that the user clicked the right mouse button (right clicked) in the window.
    hwnd = (HWND) wParam; 
    xPos = LOWORD(lParam); 
    yPos = HIWORD(lParam); 
    Parameters
    hwnd 
    Handle to the window in which the user right clicked the mouse. This can be a child window of the window receiving the message. For more information about processing this message, see the Remarks section. 
    xPos 
    Horizontal position of the cursor, in screen coordinates, at the time of the mouse click. 
    yPos 
    Vertical position of the cursor, in screen coordinates, at the time of the mouse click. 
    Return Values
    No return value.
    Remarks
    A window can process this message by displaying a shortcut menu using the TrackPopupMenu or TrackPopupMenuEx function.
    If a window does not display a shortcut menu it should pass this message to the DefWindowProc function. If a window is a child window, DefWindowProc sends the message to the parent. Otherwise, DefWindowProc displays a default shortcut menu if the specified position is in the window's caption.
    DefWindowProc generates the WM_CONTEXTMENU message when it processes the WM_RBUTTONUP or WM_NCRBUTTONUP message.

    WM_STYLECHANGING = H007C;
    当调用SETWINDOWLONG函数将要改变一个或多个 窗口的风格时发送此消息给那个窗口
    The WM_STYLECHANGING message is sent to a window when the SetWindowLong function is about to change one or more of the window's styles.
    WM_STYLECHANGING 
    wStyleType = wParam;            // window styles or extended styles 
    lpss = (LPSTYLESTRUCT) lParam;  // structure containing new styles 
     Parameters
    wStyleType 
    Value of wParam. Specifies whether the window's styles or extended styles have changed. This parameter can be a combination of the following values: Value Meaning 
    GWL_EXSTYLE The window's extended styles are changing. 
    GWL_STYLE The window's styles are changing. 
    lpss 
    Value of lParam. Pointer to a STYLESTRUCT structure that contains the proposed new styles for the window. An application can examine the styles and, if necessary, change them. 
    Return Values
    An application should return zero if it processes this message.

    WM_STYLECHANGED = H007D;
    当调用SETWINDOWLONG函数一个或多个 窗口的风格后发送此消息给那个窗口
    The WM_STYLECHANGED message is sent to a window after the SetWindowLong function has changed one or more of the window's styles.
    WM_STYLECHANGED 
    wStyleType = wParam;            // windows styles or extended styles 
    lpss = (LPSTYLESTRUCT) lParam;  // structure containing new styles  
    Parameters
    wStyleType 
    Value of wParam. Specifies whether the window's styles or extended styles have changed. This parameter can be a combination of the following values: Value Meaning 
    GWL_EXSTYLE The window's extended styles have changed. 
    GWL_STYLE The window's styles have changed. 
    lpss 
    Value of lParam. Pointer to a STYLESTRUCT structure that contains the new styles for the window. An application can examine the styles, but can not change them. 
    Return Values
    An application should return zero if it processes this message.

    WM_DISPLAYCHANGE = H007E;
    当显示器的分辨率改变后发送此消息给所有的窗口
    The WM_DISPLAYCHANGE message is sent to all windows when the display resolution has changed.
    WM_DISPLAYCHANGE 
    cBitsPerPixel = wParam; 
    cxScreen = LOWORD(lParam); 
    cyScreen = HIWORD(lParam);  
    Parameters
    cBitsPerPixel 
    Specifies the new image depth of the display in bits per pixel. 
    cxScreen 
    Specifies the new horizontal resolution of the screen. 
    cyScreen 
    Specifies the new vertical resolution of the screen.

    WM_GETICON = H007F;
    消息发送给某个窗口来返回与某个窗口有关连的大图标或小图标的句柄;
    The WM_GETICON message is sent to a window to retrieve a handle to the large or small icon associated with a window. The system displays the large icon in the Alt+Tab dialog, and the small icon in the window caption. 
    WM_GETICON 
    fType = wParam;  // icon type 
    Parameters
    fType 
    Value of wParam. Specifies the type of icon being retrieved. This parameter can be one of the following values: Value Meaning 
    ICON_BIG Retrieve the large icon for the window. 
    ICON_SMALL Retrieve the small icon for the window. 
    Return Values
    The return value is a handle to the large or small icon, depending on the value of fType. When an application receives this message, it can return a handle to a large or small icon, or pass the message to DefWindowProc.
    Default Action
    DefWindowProc returns a handle to the large or small icon associated with the window, depending on the value of fType.
    Remarks
    When an application receives this message, it can return a handle to a large or small icon, or pass the message to DefWindowProc.

    WM_SETICON = H0080;
    程序发送此消息让一个新的大图标或小图标与某个窗口关联;
    An application sends the WM_SETICON message to associate a new large or small icon with a window. The system displays the large icon in the ALT+TAB dialog, and the small icon in the window caption. 
    WM_SETICON 
    wParam = (WPARAM) fType;          // icon type
    lParam = (LPARAM) (HICON) hicon;  // handle to icon 
    Parameters
    fType 
    Value of wParam. Specifies the type of icon being set. This parameter can be one of the following values: Value Meaning 
    ICON_BIG Set the large icon for the window. 
    ICON_SMALL Set the small icon for the window. 
    hicon 
    Value of lParam. Handle to the new large or small icon. If this parameter is NULL, the icon indicated by fType is removed. 
    Return Values
    The return value is a handle to the previous large or small icon, depending on the value of fType. It is NULL if the window previously had no icon of the type indicated by fType.
    Default Action
    The DefWindowProc function returns a handle to the previous large or small icon associated with the window, depending on the value of fType.

    WM_NCCREATE = H0081;
    当某个窗口第一次被创建时,此消息在WM_CREATE消息发送前发送;
    The WM_NCCREATE message is sent prior to the WM_CREATE message when a window is first created. 
    WM_NCCREATE 
    lpcs = (LPCREATESTRUCT) lParam;  // structure with creation data  
    Parameters
    lpcs 
    Value of lParam. Pointer to the CREATESTRUCT structure that contains information about the window being created. The members of CREATESTRUCT are identical to the parameters of the CreateWindowEx function. . 
    Return Values
    If an application processes this message, it should return TRUE to continue creation of the window. If the application returns FALSE, the CreateWindow or CreateWindowEx function will return a NULL handle.

    WM_NCDESTROY = H0082;
    消息通知某个窗口,非客户区正在销毁
    The WM_NCDESTROY message informs a window that its nonclient area is being destroyed. The DestroyWindow function sends the WM_NCDESTROY message to the window following the WM_DESTROY message. WM_DESTROY is used to free the allocated memory object associated with the window. 
    WM_NCDESTROY  
    Parameters
    This message has no parameters. 
    Return Values
    If an application processes this message, it should return zero. 
    Remarks
    This message frees any memory internally allocated for the window.

    WM_NCCALCSIZE = H0083;
    当某个窗口的客户区域必须被核算时发送此消息
    The WM_NCCALCSIZE message is sent when the size and position of a window's client area must be calculated. By processing this message, an application can control the content of the window's client area when the size or position of the window changes. 
    WM_NCCALCSIZE 
    fCalcValidRects = (BOOL) wParam;        // valid area flag 
    lpncsp = (LPNCCALCSIZE_PARAMS) lParam;  // size calculation data 
       or
    lpncsp = (LPRECT) lParam;               // new window coordinates
    Parameters
    fCalcValidRects 
    The value of wParam. If wParam is TRUE, it specifies that the application should indicate which part of the client area contains valid information. The system copies the valid information to the specified area within the new client area. 
    If wParam is FALSE, the application does not need to indicate the valid part of the client area.
    lpncsp 
    Value of lParam. If wParam is TRUE, lParam points to an NCCALCSIZE_PARAMS structure that contains information an application can use to calculate the new size and position of the client rectangle. 
    If wParam is FALSE, lParam points to a RECT structure. On entry, the structure contains the proposed window rectangle for the window. On exit, the structure should contain the screen coordinates of the corresponding window client area.
    Return Values
    If the fCalcValidRects parameter is FALSE, the application should return zero.
    If fCalcValidRects is TRUE, the application should return zero or a combination of the following values: 
    Value Meaning 
    WVR_ALIGNTOP, WVR_ALIGNLEFT, WVR_ALIGNBOTTOM, WVR_ALIGNRIGHT 
     These values, used in combination, specify that the client area of the window is to be preserved and aligned appropriately relative to the new position of the window. For example, to align the client area to the lower-left corner, return the WVR_ALIGNLEFT and WVR_ALIGNBOTTOM values. 
    WVR_HREDRAW, WVR_VREDRAW 
     These values, used in combination with any other values, cause the window to be completely redrawn if the client rectangle changes size horizontally or vertically. These values are similar to the CS_HREDRAW and CS_VREDRAW class styles. 
    WVR_REDRAW 
     This value causes the entire window to be redrawn. It is a combination of WVR_HREDRAW and WVR_VREDRAW values. 
    WVR_VALIDRECTS 
     This value indicates that, upon return from WM_NCCALCSIZE, the rectangles specified by the rgrc[1] and rgrc[2] members of the NCCALCSIZE_PARAMS structure contain valid destination and source area rectangles, respectively. The system combines these rectangles to calculate the area of the window to be preserved. The system copies any part of the window image that is within the source rectangle and clips the image to the destination rectangle. Both rectangles are in parent-relative or screen-relative coordinates. 
     This return value allows an application to implement more elaborate client-area preservation strategies, such as centering or preserving a subset of the client area. 
    If fCalcValidRects is TRUE and an application returns zero, the old client area is preserved and is aligned with the upper-left corner of the new client area. 
    Default Action
    The window may be redrawn, depending on whether the CS_HREDRAW or CS_VREDRAW class style is specified. This is the default, backward-compatible processing of this message by the DefWindowProc function (in addition to the usual client rectangle calculation described in the preceding table).

    WM_NCHITTEST = H0084;
    移动鼠标,按住或释放鼠标时发生
    The WM_NCHITTEST message is sent to a window when the cursor moves, or when a mouse button is pressed or released. If the mouse is not captured, the message is sent to the window beneath the cursor. Otherwise, the message is sent to the window that has captured the mouse. 
    WM_NCHITTEST 
    xPos = LOWORD(lParam);  // horizontal position of cursor 
    yPos = HIWORD(lParam);  // vertical position of cursor  
    Parameters
    xPos 
    Value of the low-order word of lParam. Specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the screen. 
    yPos 
    Value of the high-order word of lParam. Specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the screen. 
    Return Values
    The return value of the DefWindowProc function is one of the following values, indicating the position of the cursor hot spot: 
    Value Location of hot spot 
    HTBORDER In the border of a window that does not have a sizing border 
    HTBOTTOM In the lower horizontal border of a resizable window (the user can click the mouse to resize the window vertically) 
    HTBOTTOMLEFT In the lower-left corner of a border of a resizable window (the user can click the mouse to resize the window diagonally) 
    HTBOTTOMRIGHT In the lower-right corner of a border of a resizable window (the user can click the mouse to resize the window diagonally) 
    HTCAPTION In a title bar 
    HTCLIENT In a client area 
    HTCLOSE In a close button 
    HTERROR On the screen background or on a dividing line between windows (same as HTNOWHERE, except that the DefWindowProc function produces a system beep to indicate an error) 
    HTGROWBOX In a size box (same as HTSIZE) 
    HTHELP In a Help button 
    HTHSCROLL In a horizontal scroll bar 
    HTLEFT In the left border of a resizable window (the user can click the mouse to resize the window horizontally) 
    HTMENU In a menu 
    HTMAXBUTTON In Maximize button 
    HTMINBUTTON In Minimize button 
    HTNOWHERE On the screen background or on a dividing line between windows 
    HTREDUCE In a Minimize button 
    HTRIGHT In the right border of a resizable window (the user can click the mouse to resize the window horizontally) 
    HTSIZE In a size box (same as HTGROWBOX) 
    HTSYSMENU In a System menu or in a Close button in a child window 
    HTTOP In the upper horizontal border of a window 
    HTTOPLEFT In the upper-left corner of a window border 
    HTTOPRIGHT In the upper right corner of a window border 
    HTTRANSPARENT In a window currently covered by another window in the same thread (the message will be sent to underlying windows in the same thread until one of them returns a code that is not HTTRANSPARENT) 
    HTVSCROLL In the vertical scroll bar 
    HTZOOM In a Maximize button 
    Remarks
    An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

    WM_NCPAINT = H0085;
    程序发送此消息给某个窗口当它(窗口)的框架必须被绘制时;可以在该函数中更改框架的更新区域。
    An application sends the WM_NCPAINT message to a window when its frame must be painted. 
    WM_NCPAINT 
    hrgn = (HRGN) wParam;   // handle of update region  
    Parameters
    hrgn 
    Value of wParam. Handle to the update region of the window. The update region is clipped to the window frame. When wParam is 1, the entire window frame needs to be updated. 
    This value can be passed to GetDCEx as in the following example. 
    case WM_NCPAINT:
    {
        HDC hdc;
        hdc = GetDCEx(hwnd, (HRGN)wParam, DCX_WINDOW|DCX_INTERSECTRGN);
        // Paint into this DC
        ReleaseDC(hwnd, hdc);

    Return Values
    An application returns zero if it processes this message. 
    Remarks
    The DefWindowProc function paints the window frame. 
    An application can intercept the WM_NCPAINT message and paint its own custom window frame. The clipping region for a window is always rectangular, even if the shape of the frame is altered.

    WM_NCACTIVATE = H0086;
    消息发送给某个窗口 仅当它的非客户区需要被改变来显示是激活还是非激活状态;
    The WM_NCACTIVATE message is sent to a window when its nonclient area needs to be changed to indicate an active or inactive state. 
    WM_NCACTIVATE 
    fActive = (BOOL) wParam;   // new state of the title bar or icon  
    Parameters
    fActive 
    Value of wParam. Specifies when a title bar or icon needs to be changed to indicate an active or inactive state. If an active title bar or icon is to be drawn, the fActive parameter is TRUE. It is FALSE for an inactive title bar or icon. 
    Return Values
    When the fActive parameter is FALSE, an application should return TRUE to indicate that the system should proceed with the default processing, or it should return FALSE to prevent the title bar or icon from being deactivated. When fActive is TRUE, the return value is ignored. 
    Default Action
    The DefWindowProc function draws the title bar or icon title in its active colors when the fActive parameter is TRUE and in its inactive colors when fActive is FALSE.

    WM_GETDLGCODE = H0087;
    发送此消息给某个与对话框程序关联的控件,widdows控制方位键和TAB键使输入进入此控件通过响应WM_GETDLGCODE消息,应用程序可以把他当成一个特殊的输入控件并能处理它
    The WM_GETDLGCODE message is sent to the window procedure associated with a control. By default, the system handles all keyboard input to the control; the system interprets certain types of keyboard input as dialog box navigation keys. To override this default behavior, the control can respond to the WM_GETDLGCODE message to indicate the types of input it wants to process itself.
    WM_GETDLGCODE 
    wParam;                // not used 
    pMsg = (LPMSG) lParam; // pointer to an MSG structure  
    Parameters
    pMsg 
    The value of lParam is NULL if the system is performing a query, or lParam is a pointer to an MSG structure. 
    Return Values
    The return value is one or more of the following values, indicating which type of input the application processes. 
    Value Meaning 
    DLGC_BUTTON Button. 
    DLGC_DEFPUSHBUTTON Default push button. 
    DLGC_HASSETSEL EM_SETSEL messages. 
    DLGC_RADIOBUTTON Radio button. 
    DLGC_STATIC Static control. 
    DLGC_UNDEFPUSHBUTTON Non-default push button. 
    DLGC_WANTALLKEYS All keyboard input. 
    DLGC_WANTARROWS Direction keys. 
    DLGC_WANTCHARS WM_CHAR messages. 
    DLGC_WANTMESSAGE All keyboard input (the application passes this message in the MSG structure to the control). 
    DLGC_WANTTAB tab key. 
    Default Action
    The DefWindowProc function returns zero. 
    Remarks
    Although the DefWindowProc function always returns zero in response to the WM_GETDLGCODE message, the window procedure for the predefined control classes return a code appropriate for each class. 
    The WM_GETDLGCODE message and the returned values are useful only with user-defined dialog box controls or standard controls modified by subclassing.

    WM_NCMOUSEMOVE = H00A0;
    当光标在一个窗口的非客户区内移动时发送此消息给这个窗口 //非客户区为:窗体的标题栏及窗 的边框体
    The WM_NCMOUSEMOVE message is posted to a window when the cursor is moved within the nonclient area of the window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted. 
    WM_NCMOUSEMOVE 
    nHittest = (INT) wParam;    // hit-test value 
    pts = MAKEPOINTS(lParam);   // position of cursor  
    Parameters
    nHittest 
    Value of wParam. Specifies the hit-test value returned by the DefWindowProc function as a result of processing the WM_NCHITTEST message. For a list of hit-test values, see WM_NCHITTEST. 
    pts 
    Value of lParam. Specifies aPOINTS structure that contains the x- and y-coordinates of the cursor. The coordinates are relative to the upper-left corner of the screen. 
    Return Values
    If an application processes this message, it should return zero. 
    Remarks
    If it is appropriate to do so, the system sends the WM_SYSCOMMAND message to the window. 
    An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

    WM_NCLBUTTONDOWN = H00A1;
    当光标在一个窗口的非客户区同时按下鼠标左键时提交此消息
    The WM_NCLBUTTONDOWN message is posted when the user presses the left mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted. 
    WM_NCLBUTTONDOWN 
    nHittest = (INT) wParam;    // hit-test value 
    pts = MAKEPOINTS(lParam);   // position of cursor  
    Parameters
    nHittest 
    Value of wParam. Specifies the hit-test value returned by the DefWindowProc function as a result of processing the WM_NCHITTEST message. For a list of hit-test values, see WM_NCHITTEST. 
    pts 
    Value of lParam. Specifies aPOINTS structure that contains the x- and y-coordinates of the cursor. The coordinates are relative to the upper-left corner of the screen. 
    Return Values
    If an application processes this message, it should return zero. 
    Default Action
    The DefWindowProc function tests the given point to find out the location of the cursor and performs the appropriate action. If appropriate, DefWindowProc sends the WM_SYSCOMMAND message to the window. 
    Remarks
    An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

    WM_NCLBUTTONUP = H00A2;
    当用户释放鼠标左键同时光标某个窗口在非客户区十发送此消息
    The WM_NCLBUTTONUP message is posted when the user releases the left mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted. 
    WM_NCLBUTTONUP 
    nHittest = (INT) wParam;    // hit-test value 
    pts = MAKEPOINTS(lParam);   // mouse-cursor coordinates  
    Parameters
    nHittest 
    Value of wParam. Specifies the hit-test value returned by the DefWindowProc function as a result of processing the WM_NCHITTEST message. For a list of hit-test values, see WM_NCHITTEST. 
    pts 
    Value of lParam. Specifies aPOINTS structure that contains the x- and y-coordinates of the cursor. The coordinates are relative to the upper-left corner of the screen. 
    Return Values
    If an application processes this message, it should return zero. 
    Default Action
    The DefWindowProc function tests the given point to find out the location of the cursor and performs the appropriate action. If appropriate, DefWindowProc sends the WM_SYSCOMMAND message to the window. 
    Remarks
    An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure. 
    If it is appropriate to do so, the system sends the WM_SYSCOMMAND message to the window.

    WM_NCLBUTTONDBLCLK = H00A3;
    当用户双击鼠标左键同时光标某个窗口在非客户区十发送此消息
    The WM_NCLBUTTONDBLCLK message is posted when the user double-clicks the left mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted. 
    WM_NCLBUTTONDBLCLK 
    nHittest = (INT) wParam;    // hit-test value 
    pts = MAKEPOINTS(lParam);   // position of cursor  
    Parameters
    nHittest 
    Value of wParam. Specifies the hit-test value returned by the DefWindowProc function as a result of processing the WM_NCHITTEST message. For a list of hit-test values, see WM_NCHITTEST. 
    pts 
    Value of lParam. Specifies aPOINTS structure that contains the x- and y-coordinates of the cursor. The coordinates are relative to the upper-left corner of the screen. 
    Return Values
    If an application processes this message, it should return zero. 
    Default Action
    The DefWindowProc function tests the given point to find out the location of the cursor and performs the appropriate action. If appropriate, DefWindowProc sends the WM_SYSCOMMAND message to the window. 
    Remarks
    A window need not have the CS_DBLCLKS style to receive WM_NCLBUTTONDBLCLK messages. 
    The system generates a WM_NCLBUTTONDBLCLK message when the user presses, releases, and again presses the left mouse button within the system's double-click time limit. Double-clicking the left mouse button actually generates four messages: WM_NCLBUTTONDOWN, WM_NCLBUTTONUP, WM_NCLBUTTONDBLCLK, and WM_NCLBUTTONUP again. 
    An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

    WM_NCRBUTTONDOWN = H00A4;
    当用户按下鼠标右键同时光标又在窗口的非客户区时发送此消息
    The WM_NCRBUTTONDOWN message is posted when the user presses the right mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted. 
    WM_NCRBUTTONDOWN 
    nHittest = (INT) wParam;    // hit-test value 
    pts = MAKEPOINTS(lParam);   // position of cursor  
    Parameters
    nHittest 
    Value of wParam. Specifies the hit-test value returned by the DefWindowProc function as a result of processing the WM_NCHITTEST message. For a list of hit-test values, see WM_NCHITTEST. 
    pts 
    Value of lParam. Specifies aPOINTS structure that contains the x- and y-coordinates of the cursor. The coordinates are relative to the upper-left corner of the screen. 
    Return Values
    If an application processes this message, it should return zero. 
    Remarks
    An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure. 
    If it is appropriate to do so, the system sends the WM_SYSCOMMAND message to the window.

    WM_NCRBUTTONUP = H00A5;
    当用户释放鼠标右键同时光标又在窗口的非客户区时发送此消息
    The WM_NCRBUTTONUP message is posted when the user releases the right mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted. 
    WM_NCRBUTTONUP 
    nHittest = (INT) wParam;    // hit-test value 
    pts = MAKEPOINTS(lParam);   // position of cursor  
    Parameters
    nHittest 
    Value of wParam. Specifies the hit-test value returned by the DefWindowProc function as a result of processing the WM_NCHITTEST message. For a list of hit-test values, see WM_NCHITTEST. 
    pts 
    Value of lParam. Specifies aPOINTS structure that contains the x- and y-coordinates of the cursor. The coordinates are relative to the upper-left corner of the screen. 
    Return Values
    If an application processes this message, it should return zero.
    Remarks
    An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure. 
    If it is appropriate to do so, the system sends the WM_SYSCOMMAND message to the window.

    WM_NCRBUTTONDBLCLK = H00A6;
    当用户双击鼠标右键同时光标某个窗口在非客户区十发送此消息
    The WM_NCRBUTTONDBLCLK message is posted when the user double-clicks the right mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted. 
    WM_NCRBUTTONDBLCLK 
    nHittest = (INT) wParam;    // hit-test value 
    pts = MAKEPOINTS(lParam);   // position of cursor  
    Parameters
    nHittest 
    Value of wParam. Specifies the hit-test value returned by the DefWindowProc function as a result of processing the WM_NCHITTEST message. For a list of hit-test values, see WM_NCHITTEST. 
    pts 
    Value of lParam. Specifies aPOINTS structure that contains the x- and y-coordinates of the cursor. The coordinates are relative to the upper-left corner of the screen. 
    Return Values
    If an application processes this message, it should return zero. 
    Remarks
    A window need not have the CS_DBLCLKS style to receive WM_NCRBUTTONDBLCLK messages. 
    The system generates a WM_NCRBUTTONDBLCLK message when the user presses, releases, and again presses the right mouse button within the system's double-click time limit. Double-clicking the right mouse button actually generates four messages: WM_NCRBUTTONDOWN, WM_NCRBUTTONUP, WM_NCRBUTTONDBLCLK, and WM_NCRBUTTONUP again. 
    An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure. 
    If it is appropriate to do so, the system sends the WM_SYSCOMMAND message to the window.

    WM_NCMBUTTONDOWN = H00A7;
    当用户按下鼠标中键同时光标又在窗口的非客户区时发送此消息
    The WM_NCMBUTTONDOWN message is posted when the user presses the middle mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted. 
    WM_NCMBUTTONDOWN 
    nHittest = (INT) wParam;    // hit-test value 
    pts = MAKEPOINTS(lParam);   // position of cursor 
    Parameters
    nHittest 
    Value of wParam. Specifies the hit-test value returned by the DefWindowProc function as a result of processing the WM_NCHITTEST message. For a list of hit-test values, see WM_NCHITTEST. 
    pts 
    Value of lParam. Specifies aPOINTS structure that contains the x- and y-coordinates of the cursor. The coordinates are relative to the upper-left corner of the screen. 
    Return Values
    If an application processes this message, it should return zero. 
    Remarks
    An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure. 
    If it is appropriate to do so, the system sends the WM_SYSCOMMAND message to the window.

    WM_NCMBUTTONUP = H00A8;
    当用户释放鼠标中键同时光标又在窗口的非客户区时发送此消息
    The WM_NCMBUTTONUP message is posted when the user releases the middle mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted. 
    WM_NCMBUTTONUP 
    nHittest = (INT) wParam;    // hit-test value 
    pts = MAKEPOINTS(lParam);   // position of cursor 
    Parameters
    nHittest 
    Value of wParam. Specifies the hit-test value returned by the DefWindowProc function as a result of processing the WM_NCHITTEST message. For a list of hit-test values, see WM_NCHITTEST. 
    pts 
    Value of lParam. Specifies aPOINTS structure that contains the x- and y-coordinates of the cursor. The coordinates are relative to the upper-left corner of the screen. 
    Return Values
    If an application processes this message, it should return zero. 
    Remarks
    An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure. 
    If it is appropriate to do so, the system sends the WM_SYSCOMMAND message to the window.

    WM_NCMBUTTONDBLCLK = H00A9;
    当用户双击鼠标中键同时光标又在窗口的非客户区时发送此消息
    The WM_NCMBUTTONDBLCLK message is posted when the user double-clicks the middle mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted. 
    WM_NCMBUTTONDBLCLK 
    nHittest = (INT) wParam;    // hit-test value 
    pts = MAKEPOINTS(lParam);   // position of cursor  
    Parameters
    nHittest 
    Value of wParam. Specifies the hit-test value returned by the DefWindowProc function as a result of processing the WM_NCHITTEST message. For a list of hit-test values, see WM_NCHITTEST. 
    pts 
    Value of lParam. Specifies aPOINTS structure that contains the x- and y-coordinates of the cursor. The coordinates are relative to the upper-left corner of the screen. 
    Return Values
    If an application processes this message, it should return zero. 
    Remarks
    A window need not have the CS_DBLCLKS style to receive WM_NCMBUTTONDBLCLK messages. 
    The system generates a WM_NCMBUTTONDBLCLK message when the user presses, releases, and again presses the middle mouse button within the system's double-click time limit. Double-clicking the middle mouse button actually generates four messages: WM_NCMBUTTONDOWN, WM_NCMBUTTONUP, WM_NCMBUTTONDBLCLK, and WM_NCMBUTTONUP again. 
    An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure. 
    If it is appropriate to do so, the system sends the WM_SYSCOMMAND message to the window.

    WM_KEYFIRST = H0100;

    WM_KEYDOWN = H0100; 
    按下一个键
    The WM_KEYDOWN message is posted to the window with the keyboard focus when a nonsystem key is pressed. A nonsystem key is a key that is pressed when the alt key is not pressed. 
    WM_KEYDOWN 
    nVirtKey = (int) wParam;    // virtual-key code 
    lKeyData = lParam;          // key data  
    Parameters
    nVirtKey 
    Value of wParam. Specifies the virtual-key code of the nonsystem key. 
    lKeyData 
    Value of lParam. Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown in the following table. Value Description 
    0–15 Specifies the repeat count for the current message. The value is the number of times the keystroke is auto-repeated as a result of the user holding down the key. If the keystroke is held long enough, multiple messages are sent. However, the repeat count is not cumulative. 
    16–23 Specifies the scan code. The value depends on the original equipment manufacturer (OEM). 
    24 Specifies whether the key is an extended key, such as the right-hand alt and ctrl keys that appear on an enhanced 101- or 102-key keyboard. The value is 1 if it is an extended key; otherwise, it is 0. 
    25–28 Reserved; do not use. 
    29 Specifies the context code. The value is always 0 for a WM_KEYDOWN message. 
    30 Specifies the previous key state. The value is 1 if the key is down before the message is sent, or it is 0 if the key is up. 
    31 Specifies the transition state. The value is always 0 for a WM_KEYDOWN message. 
    Return Values
    An application should return zero if it processes this message. 
    Default Action
    If the f10 key is pressed, the DefWindowProc function sets an internal flag. When DefWindowProc receives the WM_KEYUP message, the function checks whether the internal flag is set and, if so, sends a WM_SYSCOMMAND message to the top-level window. The wParam parameter of the message is set to SC_KEYMENU. 
    Remarks
    Because of the autorepeat feature, more than one WM_KEYDOWN message may be posted before a WM_KEYUP message is posted. The previous key state (bit 30) can be used to determine whether the WM_KEYDOWN message indicates the first down transition or a repeated down transition. 
    For enhanced 101- and 102-key keyboards, extended keys are the right alt and ctrl keys on the main section of the keyboard; the ins, del, home, end, page up, page down and arrow keys in the clusters to the left of the numeric keypad; and the divide (/) and enter keys in the numeric keypad. Other keyboards may support the extended-key bit in the lKeyData parameter.

    WM_KEYUP = H0101; 
    释放一个键
    The WM_KEYUP message is posted to the window with the keyboard focus when a nonsystem key is released. A nonsystem key is a key that is pressed when the alt key is not pressed, or a keyboard key that is pressed when a window has the keyboard focus. 
    WM_KEYUP 
    nVirtKey = (int) wParam;    // virtual-key code 
    lKeyData = lParam;          // key data 
     Parameters
    nVirtKey 
    Value of wParam. Specifies the virtual-key code of the nonsystem key. 
    lKeyData 
    Value of lParam. Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown in the following table. Value Description 
    0–15 Specifies the repeat count for the current message. The value is the number of times the keystroke is auto-repeated as a result of the user holding down the key. The repeat count is always one for a WM_KEYUP message. 
    16–23 Specifies the scan code. The value depends on the original equipment manufacturer (OEM). 
    24 Specifies whether the key is an extended key, such as the right-hand alt and ctrl keys that appear on an enhanced 101- or 102-key keyboard. The value is 1 if it is an extended key; otherwise, it is 0. 
    25–28 Reserved; do not use. 
    29 Specifies the context code. The value is always 0 for a WM_KEYUP message. 
    30 Specifies the previous key state. The value is always 1 for a WM_KEYUP message. 
    31 Specifies the transition state. The value is always 1 for a WM_KEYUP message. 
    Return Values
    An application should return zero if it processes this message. 
    Default Action
    The DefWindowProc function sends a WM_SYSCOMMAND message to the top-level window if the f10 key or the alt key was released. The wParam parameter of the message is set to SC_KEYMENU. 
    Remarks
    For enhanced 101- and 102-key keyboards, extended keys are the right alt and ctrl keys on the main section of the keyboard; the ins, del, home, end, page up, page down and arrow keys in the clusters to the left of the numeric keypad; and the divide (/) and enter keys in the numeric keypad. Other keyboards may support the extended-key bit in the lKeyData parameter.

    WM_CHAR = H0102; 
    按下某键,并已发出WM_KEYDOWN, WM_KEYUP消息
    The WM_CHAR message is posted to the window with the keyboard focus when a WM_KEYDOWN message is translated by the TranslateMessage function. WM_CHAR contains the character code of the key that was pressed. 
    WM_CHAR 
    chCharCode = (TCHAR) wParam;    // character code 
    lKeyData = lParam;              // key data  
    Parameters
    chCharCode 
    Value of wParam. Specifies the character code of the key. 
    lKeyData 
    Value of lParam. Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown in the following table. Value Description 
    0–15 Specifies the repeat count for the current message. The value is the number of times the keystroke is auto-repeated as a result of the user holding down the key. If the keystroke is held long enough, multiple messages are sent. However, the repeat count is not cumulative. 
    16–23 Specifies the scan code. The value depends on the original equipment manufacturer (OEM). 
    24 Specifies whether the key is an extended key, such as the right-hand alt and ctrl keys that appear on an enhanced 101- or 102-key keyboard. The value is 1 if it is an extended key; otherwise, it is 0. 
    25–28 Reserved; do not use. 
    29 Specifies the context code. The value is 1 if the alt key is held down while the key is pressed; otherwise, the value is 0. 
    30 Specifies the previous key state. The value is 1 if the key is down before the message is sent, or it is 0 if the key is up. 
    31 Specifies the transition state. The value is 1 if the key is being released, or it is 0 if the key is being pressed. 
    Return Values
    An application should return zero if it processes this message. 
    Remarks
    Because there is not necessarily a one-to-one correspondence between keys pressed and character messages generated, the information in the high-order word of the lKeyData parameter is generally not useful to applications. The information in the high-order word applies only to the most recent WM_KEYDOWN message that precedes the posting of the WM_CHAR message. 
    For enhanced 101- and 102-key keyboards, extended keys are the right alt and the right ctrl keys on the main section of the keyboard; the ins, del, home, end, page up, page down and arrow keys in the clusters to the left of the numeric keypad; and the divide (/) and enter keys in the numeric keypad. Some other keyboards may support the extended-key bit in the lKeyData parameter.

    WM_DEADCHAR = H0103;
    当用translatemessage函数翻译WM_KEYUP消息时发送此消息给拥有焦点的窗口
    The WM_DEADCHAR message is posted to the window with the keyboard focus when a WM_KEYUP message is translated by the TranslateMessage function. WM_DEADCHAR specifies a character code generated by a dead key. A dead key is a key that generates a character, such as the umlaut (double-dot), that is combined with another character to form a composite character. For example, the umlaut-O character (?) is generated by typing the dead key for the umlaut character, and then typing the O key. 
    WM_DEADCHAR 
    chCharCode = (TCHAR) wParam;    // character code 
    lKeyData = lParam;              // key data  
    Parameters
    chCharCode 
    Value of wParam. Specifies the character code generated by the dead key. 
    lKeyData 
    Value of lParam. Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown in the following table. Value Description 
    0–15 Specifies the repeat count for the current message. The value is the number of times the keystroke is auto-repeated as a result of the user holding down the key. If the keystroke is held long enough, multiple messages are sent. However, the repeat count is not cumulative. 
    16–23 Specifies the scan code. The value depends on the original equipment manufacturer (OEM). 
    24 Specifies whether the key is an extended key, such as the right-hand alt and ctrl keys that appear on an enhanced 101- or 102-key keyboard. The value is 1 if it is an extended key; otherwise, it is 0. 
    25–28 Reserved; do not use. 
    29 Specifies the context code. The value is 1 if the alt key is held down while the key is pressed; otherwise, the value is 0. 
    30 Specifies the previous key state. The value is 1 if the key is down before the message is sent, or it is 0 if the key is up. 
    31 Specifies the transition state. The value is 1 if the key is being released, or it is 0 if the key is being pressed. 
    Return Values
    An application should return zero if it processes this message. 
    Remarks
    The WM_DEADCHAR message typically is used by applications to give the user feedback about each key pressed. For example, an application can display the accent in the current character position without moving the caret. 
    Because there is not necessarily a one-to-one correspondence between keys pressed and character messages generated, the information in the high-order word of the lKeyData parameter is generally not useful to applications. The information in the high-order word applies only to the most recent WM_KEYDOWN message that precedes the posting of the WM_DEADCHAR message. 
    For enhanced 101- and 102-key keyboards, extended keys are the right alt and the right ctrl keys on the main section of the keyboard; the ins, del, home, end, page up, page down and arrow keys in the clusters to the left of the numeric keypad; and the divide (/) and enter keys in the numeric keypad. Some other keyboards may support the extended-key bit in the lKeyData parameter.

    WM_SYSKEYDOWN = H0104;
    当用户按住ALT键同时按下其它键时提交此消息给拥有焦点的窗口;
    The WM_SYSKEYDOWN message is posted to the window with the keyboard focus when the user presses the F10 key (which activates the menu bar) or holds down the alt key and then presses another key. It also occurs when no window currently has the keyboard focus; in this case, the WM_SYSKEYDOWN message is sent to the active window. The window that receives the message can distinguish between these two contexts by checking the context code in the lKeyData parameter. 
    WM_SYSKEYDOWN 
    nVirtKey = (int) wParam;    // virtual-key code 
    lKeyData = lParam;          // key data  
    Parameters
    nVirtKey 
    Value of wParam. Specifies the virtual-key code of the key being pressed. 
    lKeyData 
    Value of lParam. Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown in the following table. Value Description 
    0–15 Specifies the repeat count for the current message. The value is the number of times the keystroke is auto-repeated as a result of the user holding down the key. If the keystroke is held long enough, multiple messages are sent. However, the repeat count is not cumulative. 
    16–23 Specifies the scan code. The value depends on the original equipment manufacturer (OEM). 
    24 Specifies whether the key is an extended key, such as the right-hand alt and ctrl keys that appear on an enhanced 101- or 102-key keyboard. The value is 1 if it is an extended key; otherwise, it is 0. 
    25–28 Reserved; do not use. 
    29 Specifies the context code. The value is 1 if the ALT key is down while the key is pressed; it is 0 if the WM_SYSKEYDOWN message is posted to the active window because no window has the keyboard focus. 
    30 Specifies the previous key state. The value is 1 if the key is down before the message is sent, or it is 0 if the key is up. 
    31 Specifies the transition state. The value is always 0 for a WM_SYSKEYDOWN message. 
    Return Values
    An application should return zero if it processes this message. 
    Default Action
    The DefWindowProc function examines the given key and generates a WM_SYSCOMMAND message if the key is either tab or enter. 
    Remarks
    When the context code is zero, the message can be passed to the TranslateAccelerator function, which will handle it as though it were a normal key message instead of a character-key message. This allows accelerator keys to be used with the active window even if the active window does not have the keyboard focus. 
    Because of automatic repeat, more than one WM_SYSKEYDOWN message may occur before a WM_SYSKEYUP message is sent. The previous key state (bit 30) can be used to determine whether the WM_SYSKEYDOWN message indicates the first down transition or a repeated down transition. 
    For enhanced 101- and 102-key keyboards, enhanced keys are the right alt and ctrl keys on the main section of the keyboard; the ins, del, home, end, page up, page down and arrow keys in the clusters to the left of the numeric keypad; and the divide (/) and enter keys in the numeric keypad. Other keyboards may support the extended-key bit in the lParam parameter.
    This message is also sent whenever the user presses the F10 key without the ALT key.

    WM_SYSKEYUP = H0105;
    当用户释放一个键同时ALT 键还按着时提交此消息给拥有焦点的窗口
    The WM_SYSKEYUP message is posted to the window with the keyboard focus when the user releases a key that was pressed while the alt key was held down. It also occurs when no window currently has the keyboard focus; in this case, the WM_SYSKEYUP message is sent to the active window. The window that receives the message can distinguish between these two contexts by checking the context code in the lKeyData parameter. 
    WM_SYSKEYUP 
    nVirtKey = (int) wParam;    // virtual-key code 
    lKeyData = lParam;          // key data  
    Parameters
    nVirtKey 
    Value of wParam. Specifies the virtual-key code of the key being released. 
    lKeyData 
    Value of lParam. Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown in the following table. Value Description 
    0–15 Specifies the repeat count for the current message. The value is the number of times the keystroke is auto-repeated as a result of the user holding down the key. The repeat count is always one for a WM_SYSKEYUP message. 
    16–23 Specifies the scan code. The value depends on the original equipment manufacturer (OEM). 
    24 Specifies whether the key is an extended key, such as the right-hand alt and ctrl keys that appear on an enhanced 101- or 102-key keyboard. The value is 1 if it is an extended key; otherwise, it is 0. 
    25–28 Reserved; do not use. 
    29 Specifies the context code. The value is 1 if the ALT key is down while the key is released; it is 0 if the WM_SYSKEYDOWN message is posted to the active window because no window has the keyboard focus. 
    30 Specifies the previous key state. The value is always 1 for a WM_SYSKEYUP message. 
    31 Specifies the transition state. The value is always 1 for a WM_SYSKEYUP message. 
    Return Values
    An application should return zero if it processes this message. 
    Default Action
    The DefWindowProc function sends a WM_SYSCOMMAND message to the top-level window if the f10 key or the alt key was released. The wParam parameter of the message is set to SC_KEYMENU. 
    Remarks
    When the context code is zero, the message can be passed to the TranslateAccelerator function, which will handle it as though it were a normal key message instead of a character-key message. This allows accelerator keys to be used with the active window even if the active window does not have the keyboard focus. 
    For enhanced 101- and 102-key keyboards, extended keys are the right alt and ctrl keys on the main section of the keyboard; the ins, del, home, end, page up, page down and arrow keys in the clusters to the left of the numeric keypad; and the divide (/) and enter keys in the numeric keypad. Other keyboards may support the extended-key bit in the lKeyData parameter. 
    For non-U.S. enhanced 102-key keyboards, the right alt key is handled as a ctrl+alt key. The following table shows the sequence of messages that result when the user presses and releases this key. 
    Message Virtual-key code 
    WM_KEYDOWN VK_CONTROL 
    WM_KEYDOWN VK_MENU 
    WM_KEYUP VK_CONTROL 
    WM_SYSKEYUP VK_MENU

    WM_SYSCHAR = H0106;
    当WM_SYSKEYDOWN消息被TRANSLATEMESSAGE函数翻译后提交此消息给拥有焦点的窗口
    The WM_SYSCHAR message is posted to the window with the keyboard focus when a WM_SYSKEYDOWN message is translated by the TranslateMessage function. It specifies the character code of a system character key — that is, a character key that is pressed while the alt key is down. 
    WM_SYSCHAR 
    chCharCode = (TCHAR) wParam;   // character code 
    lKeyData = lParam;             // key data 
     Parameters
    chCharCode 
    Value of wParam. Specifies the character code of the window menu key. 
    lKeyData 
    Value of lParam. Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown in the following table: Value Meaning 
    0–15 Specifies the repeat count for the current message. The value is the number of times the keystroke was auto-repeated as a result of the user holding down the key. If the keystroke is held long enough, multiple messages are sent. However, the repeat count is not cumulative. 
    16–23 Specifies the scan code. The value depends on the original equipment manufacturer (OEM). 
    24 Specifies whether the key is an extended key, such as the right-hand alt and ctrl keys that appear on an enhanced 101- or 102-key keyboard. The value is 1 if it is an extended key; otherwise, it is 0. 
    25–28 Reserved; do not use. 
    29 Specifies the context code. The value is 1 if the alt key is held down while the key is pressed; otherwise, the value is 0. 
    30 Specifies the previous key state. The value is 1 if the key is down before the message is sent, or it is 0 if the key is up. 
    31 Specifies the transition state. The value is 1 if the key is being released, or it is 0 if the key is being pressed. 
    Return Values
    An application should return zero if it processes this message. 
    Remarks
    When the context code is zero, the message can be passed to the TranslateAccelerator function, which will handle it as though it were a standard key message instead of a system character-key message. This allows accelerator keys to be used with the active window even if the active window does not have the keyboard focus. 
    For enhanced 101- and 102-key keyboards, extended keys are the right alt and ctrl keys on the main section of the keyboard; the ins, del, home, end, page up, page down and arrow keys in the clusters to the left of the numeric keypad; the print scrn key; the break key; the numlock key; and the divide (/) and enter keys in the numeric keypad. Other keyboards may support the extended-key bit in the lKeyData parameter.

    WM_SYSDEADCHAR = H0107;
    当WM_SYSKEYDOWN消息被TRANSLATEMESSAGE函数翻译后发送此消息给拥有焦点的窗口
    The WM_SYSDEADCHAR message is sent to the window with the keyboard focus when a WM_SYSKEYDOWN message is translated by the TranslateMessage function. WM_SYSDEADCHAR specifies the character code of a system dead key — that is, a dead key that is pressed while holding down the alt key. 
    WM_SYSDEADCHAR 
    chCharCode = (TCHAR) wParam;    // character code 
    lKeyData = lParam;              // key data  
    Parameters
    chCharCode 
    Value of wParam. Specifies the character code generated by the system dead key — that is, a dead key that is pressed while holding down the alt key. 
    lKeyData 
    Value of lParam. Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown in the following table. Value Description 
    0–15 Specifies the repeat count for the current message. The value is the number of times the keystroke is auto-repeated as a result of the user holding down the key. If the keystroke is held long enough, multiple messages are sent. However, the repeat count is not cumulative. 
    16–23 Specifies the scan code. The value depends on the original equipment manufacturer (OEM). 
    24 Specifies whether the key is an extended key, such as the right-hand alt and ctrl keys that appear on an enhanced 101- or 102-key keyboard. The value is 1 if it is an extended key; otherwise, it is 0. 
    25–28 Reserved; do not use. 
    29 Specifies the context code. The value is 1 if the alt key is held down while the key is pressed; otherwise, the value is 0. 
    30 Specifies the previous key state. The value is 1 if the key is down before the message is sent, or it is 0 if the key is up. 
    31 Specifies the transition state. The value is 1 if the key is being released, or it is 0 if the key is being pressed. 
    Return Values
    An application should return zero if it processes this message. 
    Remarks
    For enhanced 101- and 102-key keyboards, extended keys are the right alt and ctrl keys on the main section of the keyboard; the ins, del, home, end, page up, page down and arrow keys in the clusters to the left of the numeric keypad; and the divide (/) and enter keys in the numeric keypad. Other keyboards may support the extended-key bit in the lKeyData parameter.

    WM_KEYLAST = H0108;

    WM_INITDIALOG = H0110;
    在一个对话框程序被显示前发送此消息给它,通常用此消息初始化控件和执行其它任务
    The WM_INITDIALOG message is sent to the dialog box procedure immediately before a dialog box is displayed. Dialog box procedures typically use this message to initialize controls and carry out any other initialization tasks that affect the appearance of the dialog box. 
    WM_INITDIALOG 
    hwndFocus = (HWND) wParam; // handle of control to receive focus 
    lInitParam = lParam;       // initialization parameter  
    Parameters
    hwndFocus 
    Value of wParam. Identifies the control to receive the default keyboard focus. The system assigns the default keyboard focus only if the dialog box procedure returns TRUE. 
    lInitParam 
    Value of lParam. Specifies additional initialization data. This data is passed to the system as the lParamInit parameter in a call to the CreateDialogIndirectParam, CreateDialogParam, DialogBoxIndirectParam, or DialogBoxParam function used to create the dialog box. For property sheets, this parameter is a pointer to thePROPSHEETPAGE structure used to create the page. This parameter is zero if any other dialog box creation function is used. 
    Return Values
    The dialog box procedure should return TRUE to direct the system to set the keyboard focus to the control given by hwndFocus. Otherwise, it should return FALSE to prevent the system from setting the default keyboard focus. 
    The dialog box procedure should return the value directly. The DWL_MSGRESULT value set by the SetWindowLong function is ignored. 
    Remarks
    The control to receive the default keyboard focus is always the first control in the dialog box that is visible, not disabled, and that has the WS_TABSTOP style. When the dialog box procedure returns TRUE, the system checks the control to ensure that the procedure has not disabled it. If it has been disabled, the system sets the keyboard focus to the next control that is visible, not disabled, and has the WS_TABSTOP. 
    An application can return FALSE only if it has set the keyboard focus to one of the controls of the dialog box.

    WM_COMMAND = H0111;
    当用户选择一条菜单命令项或当某个控件发送一条消息给它的父窗口,一个快捷键被翻译
    The WM_COMMAND message is sent when the user selects a command item from a menu, when a control sends a notification message to its parent window, or when an accelerator keystroke is translated. 
    WM_COMMAND
    wNotifyCode = HIWORD(wParam); // notification code
    wID = LOWORD(wParam);         // item, control, or accelerator identifier
    hwndCtl = (HWND) lParam;      // handle of control
    Parameters
    wNotifyCode
    Value of the high-order word of wParam. Specifies the notification code if the message is from a control. If the message is from an accelerator, this parameter is 1. If the message is from a menu, this parameter is 0. 
    wID 
    Value of the low-order word of wParam. Specifies the identifier of the menu item, control, or accelerator. 
    hwndCtl 
    Value of lParam. Handle to the control sending the message if the message is from a control. Otherwise, this parameter is NULL. 
    Return Values
    If an application processes this message, it should return zero. 
    Remarks
    Accelerator keystrokes按键 that select items from the window menu are translated into WM_SYSCOMMAND messages. 
    If an accelerator keystroke occurs that corresponds(适合) to a menu item when the window that owns the menu is minimized, no WM_COMMAND message is sent. However, if an accelerator keystroke occurs that does not match any of the items in the window's menu or in the window menu, a WM_COMMAND message is sent, even if the window is minimized. 
    If an application enables a menu separator, the system sends a WM_COMMAND message with the low-word of the wParam parameter set to zero when the user selects the separator.

    WM_SYSCOMMAND = H0112;
    A window receives this message when the user chooses a command from the window menu (formerly known as the system or control menu) or when the user chooses the maximize button, minimize button, restore button, or close button.
    WM_SYSCOMMAND 
    uCmdType = wParam;        // type of system command requested 
    xPos = LOWORD(lParam);    // horizontal position, in screen coordinates 
    yPos = HIWORD(lParam);    // vertical position, in screen coordinates  
    Parameters
    uCmdType 
    Specifies the type of system command requested. This parameter can be one of the following values. Value Meaning 
    SC_CLOSE Closes the window. 
    SC_CONTEXTHELP Changes the cursor to a question mark with a pointer. If the user then clicks a control in the dialog box, the control receives a WM_HELP message. 
    SC_DEFAULT Selects the default item; the user double-clicked the window menu. 
    SC_HOTKEY Activates the window associated with the application-specified hot key. The low-order word of lParam identifies the window to activate. 
    SC_HSCROLL Scrolls horizontally. 
    SC_KEYMENU Retrieves the window menu as a result of a keystroke. 
    SC_MAXIMIZE Maximizes the window. 
    SC_MINIMIZE Minimizes the window. 
    SC_MONITORPOWER   Sets the state of the display. This command supports devices that have power-saving features, such as a battery-powered personal computer.
    lParam can have the following values:
    1 means the display is going to low power.
    2 means the display is being shut off. 
    SC_MOUSEMENU Retrieves the window menu as a result of a mouse click. 
    SC_MOVE Moves the window. 
    SC_NEXTWINDOW Moves to the next window. 
    SC_PREVWINDOW Moves to the previous window. 
    SC_RESTORE Restores the window to its normal position and size. 
    SC_SCREENSAVE Executes the screen saver application specified in the [boot] section of the SYSTEM.INI file. 
    SC_SIZE Sizes the window. 
    SC_TASKLIST Activates the Start menu. 
    SC_VSCROLL Scrolls vertically. 
    xPos 
    Specifies the horizontal position of the cursor, in screen coordinates, if a window menu command is chosen with the mouse. Otherwise, the xPos parameter is not used. 
    yPos 
    Specifies the vertical position of the cursor, in screen coordinates, if a window menu command is chosen with the mouse. This parameter is –1 if the command is chosen using a system accelerator, or zero if using a mnenomic. 
    Return Values
    An application should return zero if it processes this message.
    Remarks
    The DefWindowProc function carries out the window menu request for the predefined actions specified in the previous table. 
    In WM_SYSCOMMAND messages, the four low-order bits of the uCmdType parameter are used internally by the system. To obtain the correct result when testing the value of uCmdType, an application must combine the value 0xFFF0 with the uCmdType value by using the bitwise AND operator. 
    The menu items in a window menu can be modified by using the GetSystemMenu, AppendMenu, InsertMenu, ModifyMenu, InsertMenuItem, and SetMenuItem functions. Applications that modify the window menu must process WM_SYSCOMMAND messages.
    An application can carry out any system command at any time by passing a WM_SYSCOMMAND message to DefWindowProc. Any WM_SYSCOMMAND messages not handled by the application must be passed to DefWindowProc. Any command values added by an application must be processed by the application and cannot be passed to DefWindowProc. 
    Accelerator keys that are defined to choose items from the window menu are translated into WM_SYSCOMMAND messages; all other accelerator keystrokes are translated into WM_COMMAND messages.

    WM_TIMER = H0113;
    发生了定时器事件
    The WM_TIMER message is posted to the installing thread's message queue when a timer expires. You can process the message by providing a WM_TIMER case in the window procedure. Otherwise, the default window procedure will call the TimerProc callback function specified in the call to the SetTimer function used to install the timer. 
    WM_TIMER 
    wTimerID = wParam;             // timer identifier 
    tmprc = (TIMERPROC *) lParam;  // address of timer callback  
    Parameters
    wTimerID 
    Value of wParam. Specifies the timer identifier. 
    tmprc 
    Value of lParam. Points to an application-defined callback function that was passed to the SetTimer function when the timer was installed. 
    Return Values
    An application should return zero if it processes this message. 
    Remarks
    The WM_TIMER message is a low-priority message. The GetMessage and PeekMessage functions retrieve this message only when no other higher-priority messages are in the thread's message queue.

    WM_HSCROLL = H0114;
    当一个窗口标准水平滚动条产生一个滚动事件时发送此消息给那个窗口,也发送给拥有它的控件
    The WM_HSCROLL message is sent to a window when a scroll event occurs in the window's standard horizontal scroll bar. This message is also sent to the owner of a horizontal scroll bar control when a scroll event occurs in the control. 
    WM_HSCROLL 
    nScrollCode = (int) LOWORD(wParam);  // scroll bar value 
    nPos = (short int) HIWORD(wParam);   // scroll box position 
    hwndScrollBar = (HWND) lParam;       // handle to scroll bar 
    Parameters
    nScrollCode 
    Value of the low-order word of wParam. Specifies a scroll bar value that indicates the user's scrolling request. This parameter can be one of the following values: Value Meaning 
    SB_ENDSCROLL Ends scroll. 
    SB_LEFT Scrolls to the upper left. 
    SB_RIGHT Scrolls to the lower right. 
    SB_LINELEFT Scrolls left by one unit. 
    SB_LINERIGHT Scrolls right by one unit. 
    SB_PAGELEFT Scrolls left by the width of the window. 
    SB_PAGERIGHT Scrolls right by the width of the window. 
    SB_THUMBPOSITION The user has dragged the scroll box (thumb) and released the mouse button. The nPos parameter indicates the position of the scroll box at the end of the drag operation. 
    SB_THUMBTRACK The user is dragging the scroll box. This message is sent repeatedly until the user releases the mouse button. The nPos parameter indicates the position that the scroll box has been dragged to. 
    nPos 
    Value of the high-order word of wParam. Specifies the current position of the scroll box if the nScrollCode parameter is SB_THUMBPOSITION or SB_THUMBTRACK; otherwise, nPos is not used. 
    hwndScrollBar 
    Value of lParam. If the message is sent by a scroll bar, then hwndScrollBar is the handle to the scroll bar control. If the message is not sent by a scroll bar, hwndScrollBar is NULL. 
    Return Values
    If an application processes this message, it should return zero. 
    Remarks
    The SB_THUMBTRACK notification message is typically used by applications that provide feedback as the user drags the scroll box. 
    If an application scrolls the content of the window, it must also reset the position of the scroll box by using the SetScrollPos function. 
    Note that the WM_HSCROLL message carries only 16 bits of scroll box position data. Thus, applications that rely solely on WM_HSCROLL (and WM_VSCROLL) for scroll position data have a practical maximum position value of 65,535. 
    However, because the SetScrollInfo, SetScrollPos, SetScrollRange, GetScrollInfo, GetScrollPos, and GetScrollRange functions support 32-bit scroll bar position data, there is a way to circumvent the 16-bit barrier of the WM_HSCROLL and WM_VSCROLL messages. See GetScrollInfo for a description of the technique.

    WM_VSCROLL = H0115;
    当一个窗口标准垂直滚动条产生一个滚动事件时发送此消息给那个窗口,也发送给拥有它的控件
    The WM_VSCROLL message is sent to a window when a scroll event occurs in the window's standard vertical scroll bar. This message is also sent to the owner of a vertical scroll bar control when a scroll event occurs in the control. 
    WM_VSCROLL 
    nScrollCode = (int) LOWORD(wParam); // scroll bar value 
    nPos = (short int) HIWORD(wParam);  // scroll box position 
    hwndScrollBar = (HWND) lParam;      // handle to scroll bar  
    Parameters
    nScrollCode 
    Value of the low-order word of wParam. Specifies a scroll bar value that indicates the user's scrolling request. This parameter can be one of the following values: Value Meaning 
    SB_BOTTOM Scrolls to the lower right. 
    SB_ENDSCROLL Ends scroll. 
    SB_LINEDOWN Scrolls one line down. 
    SB_LINEUP Scrolls one line up. 
    SB_PAGEDOWN Scrolls one page down. 
    SB_PAGEUP Scrolls one page up. 
    SB_THUMBPOSITION The user has dragged the scroll box (thumb) and released the mouse button. The nPos parameter indicates the position of the scroll box at the end of the drag operation. 
    SB_THUMBTRACK The user is dragging the scroll box. This message is sent repeatedly until the user releases the mouse button. The nPos parameter indicates the position that the scroll box has been dragged to. 
    SB_TOP Scrolls to the upper left. 
    nPos 
    Value of the high-order word of wParam. Specifies the current position of the scroll box if the nScrollCode parameter is SB_THUMBPOSITION or SB_THUMBTRACK; otherwise, nPos is not used. 
    hwndScrollBar 
    Value of lParam. If the message is sent by a scroll bar, then hwndScrollBar is the handle to the scroll bar control. If the message is not sent by a scroll bar, hwndScrollBar is NULL. 
    Return Values
    If an application processes this message, it should return zero. 
    Remarks
    The SB_THUMBTRACK notification message is typically used by applications that provide feedback as the user drags the scroll box. 
    If an application scrolls the content of the window, it must also reset the position of the scroll box by using the SetScrollPos function. 
    Note that the WM_VSCROLL message carries only 16 bits of scroll box position data. Thus, applications that rely solely on WM_VSCROLL (and WM_HSCROLL) for scroll position data have a practical maximum position value of 65,535. 
    However, because the SetScrollInfo, SetScrollPos, SetScrollRange, GetScrollInfo, GetScrollPos, and GetScrollRange functions support 32-bit scroll bar position data, there is a way to circumvent the 16-bit barrier of the WM_HSCROLL and WM_VSCROLL messages. See GetScrollInfo for a description of the technique.

    WM_INITMENU = H0116;
    当一个菜单将要被激活时发送此消息,它发生在用户菜单条中的某项或按下某个菜单键,它允许程序在显示前更改菜单
    The WM_INITMENU message is sent when a menu is about to become active. It occurs when the user clicks an item on the menu bar or presses a menu key. This allows the application to modify the menu before it is displayed. 
    WM_INITMENU 
    hmenuInit = (HMENU) wParam; // handle to menu to initialize 
     Parameters
    hmenuInit 
    Value of wParam. Handle to the menu to be initialized. 
    Return Values
    If an application processes this message, it should return zero. 
    Remarks
    A WM_INITMENU message is sent only when a menu is first accessed; only one WM_INITMENU message is generated for each access. For example, moving the mouse across several menu items while holding down the button does not generate new messages. WM_INITMENU does not provide information about menu items.

    WM_INITMENUPOPUP = H0117;
    当一个下拉菜单或子菜单将要被激活时发送此消息,它允许程序在它显示前更改菜单,而不要改变全部 
    The WM_INITMENUPOPUP message is sent when a drop-down menu or submenu is about to become active. This allows an application to modify the menu before it is displayed, without changing the entire menu. 
    WM_INITMENUPOPUP 
    hmenuPopup = (HMENU) wParam;         // handle to submenu
    uPos = (UINT) LOWORD(lParam);        // submenu item position 
    fSystemMenu = (BOOL) HIWORD(lParam); // window menu flag 
     Parameters
    hmenuPopup 
    Value of wParam. Handle to the drop-down menu or submenu. 
    uPos 
    Value of the low-order word of lParam. Specifies the zero-based relative position of the menu item that opens the drop-down menu or submenu. 
    fSystemMenu 
    Value of the high-order word of lParam. Specifies whether the drop-down menu is the window menu (also known as the System menu or the Control menu). If the menu is the window menu, this parameter is TRUE; otherwise, it is FALSE. 
    Return Values
    If an application processes this message, it should return zero.

    WM_MENUSELECT = H011F;
    当用户选择一条菜单项时发送此消息给菜单的所有者(一般是窗口)
    The WM_MENUSELECT message is sent to a menu's owner window when the user selects a menu item.
    WM_MENUSELECT 
    uItem = (UINT) LOWORD(wParam);   // menu item or submenu index 
    fuFlags = (UINT) HIWORD(wParam); // menu flags 
    hmenu = (HMENU) lParam;          // handle to menu clicked  
    Parameters
    uItem 
    Value of the low-order word of wParam. If the selected item is a command item, this parameter contains the identifier of the menu item. If the selected item opens a drop-down menu or submenu, this parameter contains the menu index of the drop-down menu or submenu in the main menu, and the hMenu parameter then contains the handle to the main (clicked) menu; use the GetSubMenu function to get the menu handle to the drop-down menu or submenu. 
    fuFlags 
    Value of the high-order word of wParam. Specifies one or more menu flags. This parameter can be a combination of the following values: Value Description 
    MF_BITMAP Item displays a bitmap. 
    MF_CHECKED Item is checked. 
    MF_DISABLED Item is disabled. 
    MF_GRAYED Item is grayed. 
    MF_HILITE Item is highlighted. 
    MF_MOUSESELECT Item is selected with the mouse. 
    MF_OWNERDRAW Item is an owner-drawn item. 
    MF_POPUP Item opens a drop-down menu or submenu. 
    MF_SYSMENU Item is contained in the window menu (also known as the System menu or Control menu). The hmenu parameter identifies the window menu associated with the message. 
    hmenu 
    Value of lParam. Handle to the menu that was clicked. 
    Return Values
    If an application processes this message, it should return zero. 
    Remarks
    If the fuFlags parameter contains 0xFFFF and the hmenu parameter contains NULL, the system has closed the menu. 
    Do not use the value –1 for fuFlags. That is because fuFlags is specified as (UINT) HIWORD(wParam). If HIWORD(wParam) were 0xFFFF, fuFlags (because of the UINT cast) would be 0x0000FFFF, not –1.

    WM_MENUCHAR = H0120;
    当菜单已被激活用户按下了某个键(不同于加速键),发送此消息给菜单的所有者;
    The WM_MENUCHAR message is sent when a menu is active and the user presses a key that does not correspond to any mnemonic or accelerator key. This message is sent to the window that owns the menu. 
    WM_MENUCHAR 
    chUser = (TCHAR) LOWORD(wParam); // character code
    fuFlag = (UINT) HIWORD(wParam);  // menu flag 
    hmenu = (HMENU) lParam;          // handle to menu  
    Parameters
    chUser 
    Value of the low-order word of wParam. Specifies the character code that corresponds to the key the user pressed. 
    fuFlag 
    Value of the high-order word of wParam. Specifies the type of the active menu. This parameter can be one of the following values: Value Meaning 
    MF_POPUP drop-down menu, submenu, or shortcut menu 
    MF_SYSMENU window menu (System menu or Control menu) 
    hmenu 
    Value of lParam. Handle to the active menu. 
    Return Values
    An application that processes this message should return one of the following values in the high-order word of the return value: 
    Value Meaning 
    MNC_IGNORE Informs the system that it should discard the character the user pressed and create a short beep on the system speaker. 
    MNC_CLOSE Informs the system that it should close the active menu. 
    MNC_EXECUTE Informs the system that it should choose the item specified in the low-order word of the return value. The owner window receives a WM_COMMAND message. 
    MNC_SELECT Informs the system that it should select the item specified in the low-order word of the return value.  
    Remarks
    The low-order word is ignored if the high-order word contains 0 or 1. An application should process this message when an accelerator is used to select a menu item that displays a bitmap.

    WM_ENTERIDLE = H0121;
    当一个模态对话框或菜单进入空载状态时发送此消息给它的所有者,一个模态对话框或菜单进入空载状态就是在处理完一条或几条先前的消息后没有消息它的列队中等待
    The WM_ENTERIDLE message is sent to the owner window of a modal dialog box or menu that is entering an idle state. A modal dialog box or menu enters an idle state when no messages are waiting in its queue after it has processed one or more previous messages. 
    WM_ENTERIDLE 
    fuSource = wParam;    // idle-source flag 
    hwnd = (HWND) lParam; // handle of dialog box or owner window  
    Parameters
    fuSource 
    Value of wParam. Specifies whether the message is the result of a dialog box or a menu being displayed. This parameter can be one of the following values: Value Meaning 
    MSGF_DIALOGBOX The system is idle because a dialog box is displayed. 
    MSGF_MENU The system is idle because a menu is displayed. 
    hwnd 
    Value of lParam. Contains the handle of the dialog box (if fuSource is MSGF_DIALOGBOX) or of the window containing the displayed menu (if fuSource is MSGF_MENU). 
    Return Values
    An application should return zero if it processes this message. 
    Remarks
    You can suppress the WM_ENTERIDLE message for a dialog box by creating the dialog box with the DS_NOIDLEMSG style.

    WM_MENURBUTTONUP = H0122;

    WM_MENUDRAG = H0123;

    WM_MENUGETOBJECT = H0124;

    WM_UNINITMENUPOPUP = H0125;

    WM_MENUCOMMAND = H0126;

    WM_CHANGEUISTATE = H0127;

    WM_UPDATEUISTATE = H0128;

    WM_QUERYUISTATE = H0129;

    WM_CTLCOLORMSGBOX = H0132;
    在windows绘制消息框前发送此消息消息框的所有者窗口,通过响应这条消息,所有者窗口可以通过使用给定的相关显示设备的句柄来设置消息框的文本和背景颜色
    The WM_CTLCOLORMSGBOX message is obsolete. It is included for compatibility with earlier versions of the system. Current versions of Windows and Windows NT do not send this message.

    WM_CTLCOLOREDIT = H0133;
    当一个编辑型控件将要被绘制时发送此消息给它的父窗口;通过响应这条消息,所有者窗口可以通过使用给定的相关显示设备的句柄来设置编辑框的文本和背景颜色
    An edit control that is not read-only or disabled sends the WM_CTLCOLOREDIT message to its parent window when the control is about to be drawn. By responding to this message, the parent window can use the specified device context handle to set the text and background colors of the edit control. 
    WM_CTLCOLOREDIT 
    hdcEdit = (HDC) wParam;   // handle to display context 
    hwndEdit = (HWND) lParam; // handle to static control  
    Parameters
    hdcEdit 
    Value of wParam. Handle to the device context for the edit control window. 
    hwndEdit 
    Value of lParam. Handle to the edit control. 
    Return Values
    If an application processes this message, it must return the handle of a brush. The system uses the brush to paint the background of the edit control. 
    Default Action
    The DefWindowProc function selects the default system colors for the edit control. 
    Remarks
    Read-only or disabled edit controls do not send the WM_CTLCOLOREDIT message; instead, they send the WM_CTLCOLORSTATIC message. However, for compatibility purposes, the system sends the WM_CTLCOLOREDIT message for read-only and disabled edit controls if the application was designed for Windows 3.1 or earlier.
    The system does not automatically destroy the returned brush. It is the application's responsibility to destroy the brush when it is no longer needed.
    The WM_CTLCOLOREDIT message is never sent between threads, it is only sent within the same thread. 
    If a dialog box procedure handles this message, it should cast the desired return value to a BOOL and return the value directly. If the dialog box procedure returns FALSE, then default message handling is performed. The DWL_MSGRESULT value set by the SetWindowLong function is ignored.

    WM_CTLCOLORLISTBOX = H0134;
    当一个列表框控件将要被绘制前发送此消息给它的父窗口;通过响应这条消息,所有者窗口可以通过使用给定的相关显示设备的句柄来设置列表框的文本和背景颜色 
    The WM_CTLCOLORLISTBOX message is sent to the parent window of a list box before the system draws the list box. By responding to this message, the parent window can set the text and background colors of the list box by using the given display device context handle. 
    WM_CTLCOLORLISTBOX 
    hdcLB = (HDC) wParam;   // handle to list box display context 
    hwndLB = (HWND) lParam; // handle to list box  
    Parameters
    hdcLB 
    Value of wParam. Handle to the device context for the list box. 
    hwndLB 
    Value of lParam. Handle to the list box. 
    Return Values
    If an application processes this message, it must return a handle to a brush. The system uses the brush to paint the background of the list box. 
    Default Action
    The DefWindowProc function selects the default system colors for the list box. 
    Remarks
    The system does not automatically destroy the returned brush. It is the application's responsibility to destroy the brush when it is no longer needed.
    The WM_CTLCOLORLISTBOX message is never sent between threads. It is sent only within one thread. 
    If a dialog box procedure handles this message, it should cast the desired return value to a BOOL and return the value directly. If the dialog box procedure returns FALSE, then default message handling is performed. The DWL_MSGRESULT value set by the SetWindowLong function is ignored.

    WM_CTLCOLORBTN = H0135;
    当一个按钮控件将要被绘制时发送此消息给它的父窗口;通过响应这条消息,所有者窗口可以通过使用给定的相关显示设备的句柄来设置按纽的文本和背景颜色
    The WM_CTLCOLORBTN message is sent to the parent window of a button when the button is about to be drawn. By responding to this message, the parent window can set a button's text and background colors. 
    WM_CTLCOLORBTN 
    hdcButton = (HDC) wParam;   // handle to the button display context 
    hwndButton = (HWND) lParam; // handle to the button  
    Parameters
    hdcButton 
    Value of wParam. Handle to the display context for the button. 
    hwndButton 
    Value of lParam. Handle to the button. 
    Return Values
    If an application processes this message, it must return a handle to a brush. The system uses the brush to paint the background of the button. 
    Default Action
    The DefWindowProc function selects the default system colors for the button. 
    Remarks
    The system does not automatically destroy the returned brush. It is the application's responsibility to destroy the brush when it is no longer needed.
    The WM_CTLCOLORBTN message is never sent between threads. It is sent only within one thread. 
    The text color of a check box or radio button applies to the box or button, its check mark, and the text. The focus rectangle for these buttons remains the system default color (typically black). The text color of a group box applies to the text but not to the line that defines the box. The text color of a push button applies only to its focus rectangle; it does not affect the color of the text. 
    If a dialog box procedure handles this message, it should cast the desired return value to a BOOL and return the value directly. If the dialog box procedure returns FALSE, then default message handling is performed. The DWL_MSGRESULT value set by the SetWindowLong function is ignored.

    WM_CTLCOLORDLG = H0136;
    当一个对话框控件将要被绘制前发送此消息给它的父窗口;通过响应这条消息,所有者窗口可以通过使用给定的相关显示设备的句柄来设置对话框的文本背景颜色
    The WM_CTLCOLORDLG message is sent to a dialog box before the system draws the dialog box. By responding to this message, the dialog box can set its text and background colors by using the given display device context handle. 
    WM_CTLCOLORDLG 
    hdcDlg = (HDC) wParam;   // handle of dialog box display context 
    hwndDlg = (HWND) lParam; // handle of dialog box  
    Parameters
    hdcDlg 
    Value of wParam. Identifies the device context for the dialog box. 
    hwndDlg 
    Value of lParam. Identifies the dialog box. 
    Return Values
    If an application processes this message, it must return the handle of a brush. The system uses the brush to paint the background of the dialog box. 
    Default Action
    The DefWindowProc function selects the default system colors for the dialog box. 
    Remarks
    The system does not automatically destroy the returned brush. It is the application's responsibility to destroy the brush when it is no longer needed.
    The WM_CTLCOLORDLG message is never sent between threads. It is sent only within one thread. 
    Note that the WM_CTLCOLORDLG message is sent to the dialog box itself; all of the other WM_CTLCOLOR* messages are sent to the owner of the control. 
    If a dialog box procedure handles this message, it should cast the desired return value to a BOOL and return the value directly. If the dialog box procedure returns FALSE, then default message handling is performed. The DWL_MSGRESULT value set by the SetWindowLong function is ignored.

    WM_CTLCOLORSCROLLBAR= H0137;
    当一个滚动条控件将要被绘制时发送此消息给它的父窗口;通过响应这条消息,所有者窗口可以通过使用给定的相关显示设备的句柄来设置滚动条的背景颜色
    The WM_CTLCOLORSCROLLBAR message is sent to the parent window of a scroll bar control when the control is about to be drawn. By responding to this message, the parent window can use the given display context handle to set the background color of the scroll bar control. 
    WM_CTLCOLORSCROLLBAR 
    hdcSB  = (HDC) wParam;   // handle to scroll-bar display context 
    hwndSB = (HWND) lParam;  // handle to scroll bar 
    Parameters
    hdcSB 
    Value of wParam. Handle to the device context for the scroll bar control. 
    hwndSB 
    Value of lParam. Handle to the scroll bar. 
    Return Values
    If an application processes this message, it must return the handle to a brush. The system uses the brush to paint the background of the scroll bar control. 
    Default Action
    The DefWindowProc function selects the default system colors for the scroll bar control. 
    Remarks
    The system does not automatically destroy the returned brush. It is the application's responsibility to destroy the brush when it is no longer needed.
    The WM_CTLCOLORSCROLLBAR message is never sent between threads; it is only sent within the same thread. 
    If a dialog box procedure handles this message, it should cast the desired return value to a BOOL and return the value directly. If the dialog box procedure returns FALSE, then default message handling is performed. The DWL_MSGRESULT value set by the SetWindowLong function is ignored.

    WM_CTLCOLORSTATIC = H0138; 
    当一个静态控件将要被绘制时发送此消息给它的父窗口;通过响应这条消息,所有者窗口可以通过使用给定的相关显示设备的句柄来设置静态控件的文本和背景颜色
    A static control, or an edit control that is read-only or disabled, sends the WM_CTLCOLORSTATIC message to its parent window when the control is about to be drawn. By responding to this message, the parent window can use the specified device context handle to set the text and background colors of the static control. 
    WM_CTLCOLORSTATIC 
    hdcStatic = (HDC) wParam;   // handle to display context 
    hwndStatic = (HWND) lParam; // handle to static control  
    Parameters
    hdcStatic 
    Value of wParam. Handle to the device context for the static control window. 
    hwndStatic 
    Value of lParam. Handle to the static control. 
    Return Values
    If an application processes this message, the return value is a handle to a brush that the system uses to paint the background of the static control. 
    Default Action
    The DefWindowProc function selects the default system colors for the static control. 
    Remarks
    Edit controls that are not read-only or disabled do not send the WM_CTLCOLORSTATIC message; instead, they send the WM_CTLCOLOREDIT message. However, for compatibility purposes, the system sends the WM_CTLCOLOREDIT message for read-only and disabled edit controls if the application was designed for Windows 3.1 or earlier.
    The system does not automatically destroy the returned brush. It is the application's responsibility to destroy the brush when it is no longer needed.
    The WM_CTLCOLORSTATIC message is never sent between threads; it is sent only within the same thread. 
    If a dialog box procedure handles this message, it should cast the desired return value to a BOOL and return the value directly. If the dialog box procedure returns FALSE, then default message handling is performed. The DWL_MSGRESULT value set by the SetWindowLong function is ignored.

    WM_MOUSEFIRST = H0200;

    WM_MOUSEMOVE = H0200; 
    // 移动鼠标
    The WM_MOUSEMOVE message is posted to a window when the cursor moves. If the mouse is not captured, the message is posted to the window that contains the cursor. Otherwise, the message is posted to the window that has captured the mouse. 
    WM_MOUSEMOVE 
    fwKeys = wParam;        // key flags 
    xPos = LOWORD(lParam);  // horizontal position of cursor 
    yPos = HIWORD(lParam);  // vertical position of cursor  
    Parameters
    fwKeys 
    Value of wParam. Indicates whether various virtual keys are down. This parameter can be any combination of the following values: Value Description 
    MK_CONTROL Set if the ctrl key is down. 
    MK_LBUTTON Set if the left mouse button is down. 
    MK_MBUTTON Set if the middle mouse button is down. 
    MK_RBUTTON Set if the right mouse button is down. 
    MK_SHIFT Set if the shift key is down. 
    xPos 
    Value of the low-order word of lParam. Specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area. 
    yPos 
    Value of the high-order word of lParam. Specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area. 
    Remarks
    The MAKEPOINTS macro can be used to convert the lParam parameter to a POINTS structure.

    WM_LBUTTONDOWN = H0201; 
    //按下鼠标左键
    The WM_LBUTTONDOWN message is posted when the user presses the left mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse. 
    WM_LBUTTONDOWN 
    fwKeys = wParam;        // key flags 
    xPos = LOWORD(lParam);  // horizontal position of cursor 
    yPos = HIWORD(lParam);  // vertical position of cursor 
     Parameters
    fwKeys 
    Value of wParam. Indicates whether various virtual keys are down. This parameter can be any combination of the following values: Value Description 
    MK_CONTROL Set if the ctrl key is down. 
    MK_LBUTTON Set if the left mouse button is down. 
    MK_MBUTTON Set if the middle mouse button is down. 
    MK_RBUTTON Set if the right mouse button is down. 
    MK_SHIFT Set if the shift key is down. 
    xPos 
    Value of the low-order word of lParam. Specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area. 
    yPos 
    Value of the high-order word of lParam. Specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area. 
    Return Values
    If an application processes this message, it should return zero. 
    Remarks
    An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

    WM_LBUTTONUP = H0202; 
    //释放鼠标左键
    The WM_LBUTTONUP message is posted when the user releases the left mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse. 
    WM_LBUTTONUP 
    fwKeys = wParam;        // key flags 
    xPos = LOWORD(lParam);  // horizontal position of cursor 
    yPos = HIWORD(lParam);  // vertical position of cursor  
    Parameters
    fwKeys 
    Value of wParam. Indicates whether various virtual keys are down. This parameter can be any combination of the following values: Value Description 
    MK_CONTROL Set if the ctrl key is down. 
    MK_MBUTTON Set if the middle mouse button is down. 
    MK_RBUTTON Set if the right mouse button is down. 
    MK_SHIFT Set if the shift key is down. 
    xPos 
    Value of the low-order word of lParam. Specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area. 
    yPos 
    Value of the high-order word of lParam. Specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area. 
    Return Values
    If an application processes this message, it should return zero. 
    Remarks
    An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

    WM_LBUTTONDBLCLK = H0203;
    //双击鼠标左键
    The WM_LBUTTONDBLCLK message is posted when the user double-clicks the left mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse. 
    WM_LBUTTONDBLCLK 
    fwKeys = wParam;        // key flags 
    xPos = LOWORD(lParam);  // horizontal position of cursor 
    yPos = HIWORD(lParam);  // vertical position of cursor 
     Parameters
    fwKeys 
    Value of wParam. Indicates whether various virtual keys are down. This parameter can be any combination of the following values: Value Description 
    MK_CONTROL Set if the ctrl key is down. 
    MK_LBUTTON Set if the left mouse button is down. 
    MK_MBUTTON Set if the middle mouse button is down. 
    MK_RBUTTON Set if the right mouse button is down. 
    MK_SHIFT Set if the shift key is down. 
    xPos 
    Value of the low-order word of lParam. Specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area. 
    yPos 
    Value of the high-order word of lParam. Specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area. 
    Return Values
    If an application processes this message, it should return zero. 
    Remarks
    Only windows that have the CS_DBLCLKS style can receive WM_LBUTTONDBLCLK messages, which the system generates whenever the user presses, releases, and again presses the left mouse button within the system's double-click time limit. Double-clicking the left mouse button actually generates four messages: WM_LBUTTONDOWN, WM_LBUTTONUP, WM_LBUTTONDBLCLK, and WM_LBUTTONUP again. 
    An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

    WM_RBUTTONDOWN = H0204;
    //按下鼠标右键
    The WM_RBUTTONDOWN message is posted when the user presses the right mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse. 
    WM_RBUTTONDOWN 
    fwKeys = wParam;        // key flags 
    xPos = LOWORD(lParam);  // horizontal position of cursor 
    yPos = HIWORD(lParam);  // vertical position of cursor 
     Parameters
    fwKeys 
    Value of wParam. Indicates whether various virtual keys are down. This parameter can be any combination of the following values: Value Description 
    MK_CONTROL Set if the ctrl key is down. 
    MK_LBUTTON Set if the left mouse button is down. 
    MK_MBUTTON Set if the middle mouse button is down. 
    MK_RBUTTON Set if the right mouse button is down. 
    MK_SHIFT Set if the shift key is down. 
    xPos 
    Value of the low-order word of lParam. Specifies the x-coordinate of the cursor. The coordinate is relative to the upper left corner of the client area. 
    yPos 
    Value of the high-order word of lParam. Specifies the y-coordinate of the cursor. The coordinate is relative to the upper left corner of the client area. 
    Return Values
    If an application processes this message, it should return zero. 
    Remarks
    An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

    WM_RBUTTONUP = H0205;
    //释放鼠标右键
    The WM_RBUTTONUP message is posted when the user releases the right mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse. 
    WM_RBUTTONUP 
    fwKeys = wParam;        // key flags 
    xPos = LOWORD(lParam);  // horizontal position of cursor 
    yPos = HIWORD(lParam);  // vertical position of cursor  
    Parameters
    fwKeys 
    Value of wParam. Indicates whether various virtual keys are down. This parameter can be any combination of the following values: Value Description 
    MK_CONTROL Set if the ctrl key is down. 
    MK_LBUTTON Set if the left mouse button is down. 
    MK_MBUTTON Set if the middle mouse button is down. 
    MK_SHIFT Set if the shift key is down. 
    xPos 
    Value of the low-order word of lParam. Specifies the x-coordinate of the cursor. The coordinate is relative to the upper left corner of the client area. 
    yPos 
    Value of the high-order word of lParam. Specifies the y-coordinate of the cursor. The coordinate is relative to the upper left corner of the client area. 
    Return Values
    If an application processes this message, it should return zero. 
    Remarks
    An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

    WM_RBUTTONDBLCLK = H0206; 
    //双击鼠标右键
    The WM_RBUTTONDBLCLK message is posted when the user double-clicks the right mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse. 
    WM_RBUTTONDBLCLK 
    fwKeys = wParam;        // key flags 
    xPos = LOWORD(lParam);  // horizontal position of cursor 
    yPos = HIWORD(lParam);  // vertical position of cursor 
     Parameters
    fwKeys 
    Value of wParam. Indicates whether various virtual keys are down. This parameter can be any combination of the following values: Value Description 
    MK_CONTROL Set if the ctrl key is down. 
    MK_LBUTTON Set if the left mouse button is down. 
    MK_MBUTTON Set if the middle mouse button is down. 
    MK_RBUTTON Set if the right mouse button is down. 
    MK_SHIFT Set if the shift key is down. 
    xPos 
    Value of the low-order word of lParam. Specifies the x-coordinate of the cursor. The coordinate is relative to the upper left corner of the client area. 
    yPos 
    Value of the high-order word of lParam. Specifies the y-coordinate of the cursor. The coordinate is relative to the upper left corner of the client area. 
    Return Values
    If an application processes this message, it should return zero. 
    Remarks
    Only windows that have the CS_DBLCLKS style can receive WM_RBUTTONDBLCLK messages, which the system generates whenever the user presses, releases, and again presses the right mouse button within the system's double-click time limit. Double-clicking the right mouse button actually generates four messages: WM_RBUTTONDOWN, WM_RBUTTONUP, WM_RBUTTONDBLCLK, and WM_RBUTTONUP again. 
    An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

    WM_MBUTTONDOWN = H0207;
    //按下鼠标中键
    The WM_MBUTTONDOWN message is posted when the user presses the middle mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse. 
    WM_MBUTTONDOWN
    fwKeys = wParam;        // key flags
    xPos = LOWORD(lParam);  // horizontal position of cursor
    yPos = HIWORD(lParam);  // vertical position of cursor
     Parameters
    fwKeys
    Value of wParam. Indicates whether various virtual keys are down. This parameter can be any combination of the following values: Value Description 
    MK_CONTROL Set if the ctrl key is down. 
    MK_LBUTTON Set if the left mouse button is down. 
    MK_MBUTTON Set if the middle mouse button is down. 
    MK_RBUTTON Set if the right mouse button is down. 
    MK_SHIFT Set if the shift key is down. 
    xPos 
    Value of the low-order word of lParam. Specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area. 
    yPos 
    Value of the high-order word of lParam. Specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area. 
    Return Values
    If an application processes this message, it should return zero. 
    Remarks
    An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

    WM_MBUTTONUP = H0208; 
    //释放鼠标中键
    The WM_MBUTTONUP message is posted when the user releases the middle mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse. 
    WM_MBUTTONUP 
    fwKeys = wParam;        // key flags 
    xPos = LOWORD(lParam);  // horizontal position of cursor 
    yPos = HIWORD(lParam);  // vertical position of cursor 
     Parameters
    fwKeys 
    Value of wParam. Indicates whether various virtual keys are down. This parameter can be any combination of the following values: Value Description 
    MK_CONTROL Set if the ctrl key is down. 
    MK_LBUTTON Set if the left mouse button is down. 
    MK_RBUTTON Set if the right mouse button is down. 
    MK_SHIFT Set if the shift key is down. 
    xPos 
    Value of the low-order word of lParam. Specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area. 
    yPos 
    Value of the high-order word of lParam. Specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area. 
    An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

    WM_MBUTTONDBLCLK = H0209; 
    //双击鼠标中键
    The WM_MBUTTONDBLCLK message is posted when the user double-clicks the middle mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse. 
    WM_MBUTTONDBLCLK 
    fwKeys = wParam;        // key flags 
    xPos = LOWORD(lParam);  // horizontal position of cursor 
    yPos = HIWORD(lParam);  // vertical position of cursor 
    Parameters
    fwKeys 
    Value of wParam. Indicates whether various virtual keys are down. This parameter can be any combination of the following values: Value Description 
    MK_CONTROL Set if the ctrl key is down. 
    MK_LBUTTON Set if the left mouse button is down. 
    MK_MBUTTON Set if the middle mouse button is down. 
    MK_RBUTTON Set if the right mouse button is down. 
    MK_SHIFT Set if the shift key is down. 
    xPos 
    Value of the low-order word of lParam. Specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area. 
    yPos 
    Value of the high-order word of lParam. Specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area. 
    Return Values
    If an application processes this message, it should return zero. 
    Remarks
    Only windows that have the CS_DBLCLKS style can receive WM_MBUTTONDBLCLK messages, which the system generates whenever the user presses, releases, and again presses the middle mouse button within the system's double-click time limit. Double-clicking the middle mouse button actually generates four messages: WM_MBUTTONDOWN, WM_MBUTTONUP, WM_MBUTTONDBLCLK, and WM_MBUTTONUP again. 
    An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

    WM_MOUSEWHEEL = H020A;522
    当鼠标轮子转动时发送此消息给当前有焦点的控件
    The WM_MOUSEWHEEL message is sent to the focus window when the mouse wheel is rotated. The DefWindowProc function propagates the message to the window's parent. There should be no internal forwarding of the message, since DefWindowProc propagates it up the parent chain until it finds a window that processes it.
    WM_MOUSEWHEEL
    fwKeys = LOWORD(wParam);    // key flags
    zDelta = (short) HIWORD(wParam);    // wheel rotation
    xPos = (short) LOWORD(lParam);    // horizontal position of pointer
    yPos = (short) HIWORD(lParam);    // vertical position of pointer 
    Parameters
    fwKeys 
    Value of the low-order word of wParam. Indicates whether various virtual keys are down. This parameter can be any combination of the following values: Value Description 
    MK_CONTROL Set if the ctrl key is down. 
    MK_LBUTTON Set if the left mouse button is down. 
    MK_MBUTTON Set if the middle mouse button is down. 
    MK_RBUTTON Set if the right mouse button is down. 
    MK_SHIFT Set if the shift key is down. 
    zDelta 
    The value of the high-order word of wParam. Indicates the distance that the wheel is rotated, expressed in multiples or divisions of WHEEL_DELTA, which is 120. A positive value indicates that the wheel was rotated forward, away from the user; a negative value indicates that the wheel was rotated backward, toward the user. 
    xPos 
    Value of the low-order word of lParam. Specifies the x-coordinate of the pointer, relative to the upper-left corner of the screen. 
    yPos 
    Value of the high-order word of lParam. Specifies the y-coordinate of the pointer, relative to the upper-left corner of the screen. 
    Remarks
    The zDelta parameter will be a multiple of WHEEL_DELTA, which is set at 120. This is the threshold for action to be taken, and one such action (for example, scrolling one increment) should occur for each delta.
    The delta was set to 120 to allow Microsoft or other vendors to build finer-resolution wheels in the future, including perhaps a freely-rotating wheel with no notches. The expectation is that such a device would send more messages per rotation, but with a smaller value in each message. To support this possibility, you should either add the incoming delta values until WHEEL_DELTA is reached (so for a given delta-rotation you get the same response), or scroll partial lines in response to the more frequent messages. You could also choose your scroll granularity and accumulate deltas until it is reached.

    WM_MOUSELAST = H020A;

    WM_PARENTNOTIFY = H0210;
    当MDI子窗口被创建或被销毁,或用户按了一下鼠标键而光标在子窗口上时发送此消息给它的父窗口
    The WM_PARENTNOTIFY message is sent to the parent of a child window when the child window is created or destroyed, or when the user clicks a mouse button while the cursor is over the child window. When the child window is being created, the system sends WM_PARENTNOTIFY just before the CreateWindow or CreateWindowEx function that creates the window returns. When the child window is being destroyed, the system sends the message before any processing to destroy the window takes place. 
    WM_PARENTNOTIFY 
    fwEvent = LOWORD(wParam);  // event flags 
    idChild = HIWORD(wParam);  // identifier of child window 
    lValue = lParam;           // child handle, or cursor coordinates  
    Parameters
    fwEvent 
    Value of the low-order word of wParam. Specifies the event for which the parent is being notified. This parameter can be one of the following values: Value Meaning 
    WM_CREATE The child window is being created. 
    WM_DESTROY The child window is being destroyed. 
    WM_LBUTTONDOWN The user has placed the cursor over the child window and has clicked the left mouse button. 
    WM_MBUTTONDOWN The user has placed the cursor over the child window and has clicked the middle mouse button. 
    WM_RBUTTONDOWN The user has placed the cursor over the child window and has clicked the right mouse button. 
    idChild 
    Value of the high-order word of wParam. If the fwEvent parameter is the WM_CREATE or WM_DESTROY value, idChild specifies the identifier of the child window. Otherwise, idChild is undefined. 
    lValue 
    Contains a handle to the child window, if the fwEvent parameter is the WM_CREATE or WM_DESTROY value; otherwise, lValue contains the x- and y-coordinates of the cursor. The x-coordinate is in the low-order word and the y-coordinate is in the high-order word. 
    Return Values
    If an application processes this message, it should return zero. 
    Remarks
    This message is also sent to all ancestor windows of the child window, including the top-level window.
    All child windows, except those that have the WS_EX_NOPARENTNOTIFY extended window style, send this message to their parent windows. By default, child windows in a dialog box have the WS_EX_NOPARENTNOTIFY style, unless the CreateWindowEx function is called to create the child window without this style.

    WM_ENTERMENULOOP = H0211;
    发送此消息通知应用程序的主窗口that已经进入了菜单循环模式
    The WM_ENTERMENULOOP message informs an application's main window procedure that a menu modal loop has been entered. 
    WM_ENTERMENULOOP 
    wParam = (BOOL) fIsTrackPopupMenu  // flags a shortcut menu 
    lParam = 0 ;                       // not used; must be zero 
     Parameters
    fIsTrackPopupMenu 
    Specifies whether the window menu was entered using the TrackPopupMenu function. This parameter has a value of TRUE if the window menu was entered using TrackPopupMenu, and FALSE if it was not. 
    Return Values
    An application should return zero if it processes this message. 
    Remarks
    The DefWindowProc function returns zero.

    WM_EXITMENULOOP = H0212;
    发送此消息通知应用程序的主窗口that已退出了菜单循环模式
    The WM_EXITMENULOOP message informs an application's main window procedure that a menu modal loop has been exited. 
    WM_EXITLOOP 
    wParam = (BOOL) fIsTrackPopupMenu    // flags a shortcut menu 
    lParam = 0 ;                         // not used; must be zero 
    Parameters
    fIsTrackPopupMenu 
    Specifies whether the menu involved is a shortcut menu. This parameter has a value of TRUE if it is a shortcut menu, FALSE if it isn't. 
    Return Values
    An application should return zero if it processes this message. 
    Remarks
    The DefWindowProc function returns zero.

    WM_NEXTMENU = H0213;

    WM_SIZING = 532;
    当用户正在调整窗口大小时发送此消息给窗口;通过此消息应用程序可以监视窗口大小和位置也可以修改他们
    The WM_SIZING message is sent to a window that the user is resizing. By processing this message, an application can monitor the size and position of the drag rectangle and, if needed, change its size or position.
    fwSide = wParam;         // edge of window being sized 
    lprc = (LPRECT) lParam;  // screen coordinates of drag rectangle  
    Parameters
    fwSide 
    Value of wParam. Indicates which edge of the window is being sized. This parameter can be a combination of the following values: Value Meaning 
    WMSZ_BOTTOM Bottom edge 
    WMSZ_BOTTOMLEFT Bottom-left corner 
    WMSZ_BOTTOMRIGHT Bottom-right corner 
    WMSZ_LEFT Left edge 
    WMSZ_RIGHT Right edge 
    WMSZ_TOP Top edge 
    WMSZ_TOPLEFT Top-left corner 
    WMSZ_TOPRIGHT Top-right corner 
    lprc 
    Address of a RECT structure with the screen coordinates of the drag rectangle. To change the size or position of the drag rectangle, an application must change the members of this structure. 
    Return Values
    An application should return TRUE if it processes this message.

    WM_CAPTURECHANGED = 533;
    发送此消息给窗口当它失去捕获的鼠标时;
    The WM_CAPTURECHANGED message is sent to the window that is losing the mouse capture. 
    WM_CAPTURECHANGED 
    hwndNewCapture = (HWND) lParam;    // handle of window to gain mouse capture  
    Parameters
    hwndNewCapture 
    Value of lParam. Handle to the window that is gaining the mouse capture. 
    Return Values
    An application should return zero if it processes this message. 
    Remarks
    A window receives this message even if it calls ReleaseCapture itself. An application should not attempt to set the mouse capture in response to this message.
    When it receives this message, a window should redraw itself, if necessary, to reflect the new mouse-capture state.

    WM_MOVING = 534;
    当用户在移动窗口时发送此消息,通过此消息应用程序可以监视窗口大小和位置也可以修改他们;
    The WM_MOVING message is sent to a window that the user is moving. By processing this message, an application can monitor the size and position of the drag rectangle and, if needed, change its size or position.
    fwSide = wParam;           // edge of window to be moved 
    lprc = (LPRECT) lParam;    // screen coordinates of drag rectangle  
    Parameters
    fwSide 
    Value of wParam. Indicates which edge of the window is being moved. This parameter can be a combination of the following values: Value Meaning 
    WMSZ_BOTTOM Bottom edge 
    WMSZ_BOTTOMLEFT Bottom-left corner 
    WMSZ_BOTTOMRIGHT Bottom-right corner 
    WMSZ_LEFT Left edge 
    WMSZ_RIGHT Right edge 
    WMSZ_TOP Top edge 
    WMSZ_TOPLEFT Top-left corner 
    WMSZ_TOPRIGHT Top-right corner 
    lprc 
    Value of lParam. Address of aRECT structure with the screen coordinates of the drag rectangle. To change the size or position of the drag rectangle, an application must change the members of this structure. 
    Return Values
    An application should return TRUE if it processes this message.

    WM_POWERBROADCAST = 536;
    消息发送给应用程序来通知它有关电源管理事件;
    The WM_POWERBROADCAST message is sent to an application to notify it of power-management events. 
    dwPowerEvent = (DWORD) wParam;
    dwData = (DWORD) lParam; 
    Parameters
    dwPowerEvent 
    Event notification message. This parameter can be one of the following values. Value Meaning 
    PBT_APMBATTERYLOW Battery power is low. 
    PBT_APMOEMEVENT OEM-defined event occurred. 
    PBT_APMPOWERSTATUSCHANGE Power status has changed. 
    PBT_APMQUERYSUSPEND Request for permission to suspend. 
    PBT_APMQUERYSUSPENDFAILED Suspension request denied. 
    PBT_APMRESUMEAUTOMATIC Operation resuming automatically after event. 
    PBT_APMRESUMECRITICAL Operation resuming after critical suspension. 
    PBT_APMRESUMESUSPEND Operation resuming after suspension. 
    PBT_APMSUSPEND System is suspending operation. 
    dwData 
    Function-specific data. For most messages, this parameter is reserved and not used. 
    However, if wParam is one of the resume notifications (PBT_APMRESUME*), the lParam parameter can specify the PBTF_APMRESUMEFROMFAILURE flag. This flag indicates that a suspend operation failed after the PBT_APMSUSPEND message was sent. 
    Return Values
    Return TRUE to grant a request.
    Return BROADCAST_QUERY_DENY to deny a request.

    WM_DEVICECHANGE = 537;
    当设备的硬件配置改变时发送此消息给应用程序或设备驱动程序
    The WM_DEVICECHANGE device message notifies an application or device driver of a change to the hardware configuration of a device or the computer.
    Event = (UINT) wParam;
    dwData = (DWORD) lParam; 
    Parameters
    Event 
    Event type. This parameter can be one of the following values: Value Meaning 
    DBT_CONFIGCHANGECANCELED  A request to change the current configuration (dock or undock) has been canceled. 
    DBT_CONFIGCHANGED The current configuration has changed, due to a dock or undock.  
    DBT_DEVICEARRIVAL A device has been inserted and is now available.  
    DBT_DEVICEQUERYREMOVE Permission is requested to remove a device. Any application can deny this request and cancel the removal. 
    DBT_DEVICEQUERYREMOVEFAILED A request to remove a device has been canceled. 
    DBT_DEVICEREMOVECOMPLETE A device has been removed. 
    DBT_DEVICEREMOVEPENDING A device is about to be removed. Cannot be denied. 
    DBT_DEVICETYPESPECIFIC A device-specific event has occurred. 
    DBT_QUERYCHANGECONFIG  Permission is requested to change the current configuration (dock or undock).  
    DBT_USERDEFINED  The meaning of this message is user-defined. 
    dwData 
    Address of a structure that contains event-specific data. Its meaning depends on the given event. 
    Return Values
    Return TRUE to grant a requested action.
    Return BROADCAST_QUERY_DENY to deny a requested action.
    Remarks
    For devices that offer software-controllable features, such as ejection and locking, the system typically sends a DBT_DEVICEREMOVEPENDING message to let applications and device drivers end their use of the device gracefully. 
    If the system forcibly removes a device, it may not send a DBT_DEVICEQUERYREMOVE message before doing so.
    DBT_CONFIGCHANGECANCELED, DBT_CONFIGCHANGED, DBT_DEVICEARRIVAL, DBT_DEVICEQUERYREMOVE, DBT_DEVICEQUERYREMOVEFAILED, DBT_DEVICEREMOVECOMPLETE, DBT_DEVICEREMOVEPENDING, DBT_DEVICETYPESPECIFIC, DBT_QUERYCHANGECONFIG, DBT_USERDEFINED

    WM_IME_STARTCOMPOSITION = H010D;

    WM_IME_ENDCOMPOSITION = H010E;

    WM_IME_COMPOSITION = H010F;

    WM_IME_KEYLAST = H010F;

    WM_IME_SETCONTEXT = H0281;

    WM_IME_NOTIFY = H0282;

    WM_IME_CONTROL = H0283;

    WM_IME_COMPOSITIONFULL = H0284;

    WM_IME_SELECT = H0285;

    WM_IME_CHAR = H0286;

    WM_IME_REQUEST = H0288;

    WM_IME_KEYDOWN = H0290;

    WM_IME_KEYUP = H0291;

    WM_MDICREATE = H0220;
    应用程序发送此消息给多文档的客户窗口来创建一个MDI 子窗口
    An application sends the WM_MDICREATE message to a multiple document interface (MDI) client window to create an MDI child window. 
    WM_MDICREATE 
    wParam = 0;                                     // not used; must be zero 
    lParam = (LPARAM) (LPMDICREATESTRUCT) lpmdic;   // creation data  
    Parameters
    lpmdic 
    Pointer to an MDICREATESTRUCT structure containing information that the system uses to create the MDI child window. 
    Return Values
    If the message succeeds, the return value is the handle to the new child window.
    If the message fails, the return value is NULL. 
    Remarks
    The MDI child window is created with the style bits WS_CHILD, WS_CLIPSIBLINGS, WS_CLIPCHILDREN, WS_SYSMENU, WS_CAPTION, WS_THICKFRAME, WS_MINIMIZEBOX, and WS_MAXIMIZEBOX, plus additional style bits specified in the MDICREATESTRUCT structure to which the lpmdic parameter points. The system adds the title of the new child window to the Window menu of the frame window. An application should use this message to create all child windows of the client window. 
    If an MDI client window receives any message that changes the activation of its child windows while the active child window is maximized, the system restores the active child window and maximizes the newly activated child window. 
    When an MDI child window is created, the system sends the WM_CREATE message to the window. The lParam parameter of the WM_CREATE message contains a pointer to a CREATESTRUCT structure. The lpCreateParams member of this structure contains a pointer to the MDICREATESTRUCT structure passed with the WM_MDICREATE message that created the MDI child window. 
    An application should not send a second WM_MDICREATE message while a WM_MDICREATE message is still being processed. For example, it should not send a WM_MDICREATE message while an MDI child window is processing its WM_MDICREATE message.

    WM_MDIDESTROY = H0221;
    应用程序发送此消息给多文档的客户窗口来关闭一个MDI 子窗口
    An application sends the WM_MDIDESTROY message to a multiple document interface (MDI) client window to close an MDI child window. 
    WM_MDIDESTROY 
    wParam = (WPARAM) (HWND) hwndChild; // handle to child to close 
    lParam = 0;                         // not used; must be zero  
    Parameters
    hwndChild 
    Value of wParam. Handle to the MDI child window to be closed. 
    Return Values
    This message always returns zero. 
    Remarks
    This message removes the title of the MDI child window from the MDI frame window and deactivates the child window. An application should use this message to close all MDI child windows. 
    If an MDI client window receives a message that changes the activation of its child windows and the active MDI child window is maximized, the system restores the active child window and maximizes the newly activated child window.

    WM_MDIACTIVATE = H0222;
    应用程序发送此消息给多文档的客户窗口通知客户窗口激活另一个MDI子窗口,当客户窗口收到此消息后,它发出WM_MDIACTIVE消息给MDI子窗口(未激活)激活它;
    An application sends the WM_MDIACTIVATE message to a multiple document interface (MDI) client window to instruct the client window to activate a different MDI child window. As the client window processes this message, it sends WM_MDIACTIVATE to the child window being deactivated and to the child window being activated. 
    WM_MDIACTIVATE 
    // Message sent to MDI client 
    wParam = (WPARAM) (HWND) hwndChildAct; // child to activate 
    lParam = 0;                            // not used; must be zero  
    // Message received by MDI child 
    hwndChildDeact = (HWND) wParam;        // child being deactivated 
    hwndChildAct = (HWND) lParam;          // child being activated  
    Parameters
    In messages sent to an MDI client window: 
    hwndChildAct 
    Value of wParam. Handle to the MDI child window to be activated. 
    In messages received by an MDI child window: 
    hwndChildDeact 
    Value of wParam. Handle to the MDI child window being deactivated. 
    hwndChildAct 
    Value of lParam. Handle to the MDI child window being activated. 
    Return Values
    If an application sends this message to an MDI client window, the return value is zero. An MDI child window should return zero if it processes this message. 
    Remarks
    An MDI child window is activated independently of the MDI frame window. When the frame window becomes active, the child window last activated by using the WM_MDIACTIVATE message receives the WM_NCACTIVATE message to draw an active window frame and title bar; the child window does not receive another WM_MDIACTIVATE message.

    WM_MDIRESTORE = H0223;
    程序 发送此消息给MDI客户窗口让子窗口从最大最小化恢复到原来大小
    An application sends the WM_MDIRESTORE message to a multiple document interface (MDI) client window to restore an MDI child window from maximized or minimized size. 
    WM_MDIRESTORE 
    wParam = (WPARAM) (HWND) hwndRes; // handle to child to restore 
    lParam = 0;                       // not used; must be zero  
    Parameters
    hwndRes 
    Value of wParam. Handle to the MDI child window to be restored. 
    Return Values
    The return value is always zero.

    WM_MDINEXT = H0224;
    程序 发送此消息给MDI客户窗口激活下一个或前一个窗口
    An application sends the WM_MDINEXT message to a multiple document interface (MDI) client window to activate the next or previous child window. 
    WM_MDINEXT 
    wParam = (WPARAM) (HWND) hwndChild; // handle to child 
    lParam = (LPARAM) fNext;            // next or previous child  
    Parameters
    hwndChild 
    Value of wParam. Handle to the MDI child window. The system activates the child window that is immediately before or after the given child window, depending on the value of the fNext parameter. If the hwndChild parameter is NULL, the system activates the child window that is immediately before or after the currently active child window. 
    fNext 
    Value of lParam. If this parameter is zero, the system activates the next MDI child window and places the child window identified by the hwndChild parameter behind all other child windows. If this parameter is nonzero, the system activates the previous child window, placing it in front of the child window identified by hwndChild. 
    Return Values
    The return value is always zero. 
    Remarks
    If an MDI client window receives any message that changes the activation of its child windows while the active MDI child window is maximized, the system restores the active child window and maximizes the newly activated child window.

    WM_MDIMAXIMIZE = H0225;
    程序发送此消息给MDI客户窗口来最大化一个MDI子窗口;
    An application sends the WM_MDIMAXIMIZE message to a multiple document interface (MDI) client window to maximize an MDI child window. The system resizes the child window to make its client area fill the client window. The system places the child window's window menu icon in the rightmost position of the frame window's menu bar, and places the child window's restore icon in the leftmost position. The system also appends the title bar text of the child window to that of the frame window. 
    WM_MDIMAXIMIZE 
    wParam = (WPARAM) (HWND) hwndMax; // handle to child to maximize 
    lParam = 0;                       // not used; must be zero  
    Parameters
    hwndMax 
    Value of wParam. Handle to the MDI child window to be maximized. 
    Return Values
    The return value is always zero. 
    Remarks
    If an MDI client window receives any message that changes the activation of its child windows while the currently active MDI child window is maximized, the system restores the active child window and maximizes the newly activated child window.

    WM_MDITILE = H0226;
    程序 发送此消息给MDI客户窗口以平铺方式重新排列所有MDI子窗口
    An application sends the WM_MDITILE message to a multiple document interface (MDI) client window to arrange all of its MDI child windows in a tile format. 
    WM_MDITILE 
    wParam = (WPARAM) (UINT) fuTile; // tiling flag 
    lParam = 0;                      // not used; must be zero  
    Parameters
    fuTile 
    Specifies a tiling flag. This parameter can be one of the following values: Value Meaning 
    MDITILE_HORIZONTAL Tiles MDI child windows so that they are wide rather than tall. 
    MDITILE_SKIPDISABLED Prevents disabled MDI child windows from being tiled. 
    MDITILE_VERTICAL Tiles MDI child windows so that they are tall rather than wide. 
    Return Values
    If the message succeeds, the return value is TRUE.
    If the message fails, the return value is FALSE.

    WM_MDICASCADE = H0227;
    程序 发送此消息给MDI客户窗口以层叠方式重新排列所有MDI子窗口
    An application sends the WM_MDICASCADE message to a multiple document interface (MDI) client window to arrange all its child windows in a cascade format. 
    WM_MDICASCADE 
    wParam = (WPARAM) (UINT) fuCascade;  // cascade flag 
    lParam = 0;                          // not used; must be zero  
    Parameters
    fuCascade 
    Value of wParam. Specifies a cascade flag. The only flag currently available, MDITILE_SKIPDISABLED, prevents disabled MDI child windows from being cascaded. 
    Return Values
    If the message succeeds, the return value is TRUE.
    If the message fails, the return value is FALSE.

    WM_MDIICONARRANGE = H0228;
    程序 发送此消息给MDI客户窗口重新排列所有最小化的MDI子窗口
    An application sends the WM_MDIICONARRANGE message to a multiple document interface (MDI) client window to arrange all minimized MDI child windows. It does not affect child windows that are not minimized. 
    WM_MDIICONARRANGE 
    wParam = 0; // not used; must be zero 
    lParam = 0; // not used; must be zero 
     Parameters
    This message has no parameters.

    WM_MDIGETACTIVE = H0229;
    程序 发送此消息给MDI客户窗口来找到激活的子窗口的句柄
    An application sends the WM_MDIGETACTIVE message to a multiple document interface (MDI) client window to retrieve the handle to the active MDI child window. 
    WM_MDIGETACTIVE 
    wParam = 0;                      // not used; must be zero 
    lParam = (LPBOOL) lpfMaximized;  // optional pointer to maximized state flag  
    Parameters
    lpfMaximized 
    Value of lparam. This is an optional pointer to a maximized state flag variable. If lpfMaximized is non-NULL, the BOOL it points to is set to indicate the maximized state of the MDI child window. TRUE indicates that the window is maximized, FALSE indicates that it is not. This is equivalent to the indication supplied by the high-order word of the return value of the WM_MDIGETACTIVE message under 16-bit Windows. If lpfMaximized is NULL, the parameter is ignored. 
    Return Values
    The return value is the handle to the active MDI child window. 
    Remarks
    Note carefully a change in how this message indicates maximization. In 16-bit Windows, the message return value includes a flag indicating whether the MDI child window is maximized. In the Win32 API, the return value does not include this flag. Instead, the MDI child window's maximized state is indicated by setting a BOOL variable via the optional parameter in lParam, lpfMaximized.

    WM_MDISETMENU = H0230;
    程序 发送此消息给MDI客户窗口用MDI菜单代替子窗口的菜单
    An application sends the WM_MDISETMENU message to a multiple document interface (MDI) client window to replace the entire menu of an MDI frame window, to replace the Window menu of the frame window, or both. 
    WM_MDISETMENU 
    wParam = (WPARAM) (HMENU) hmenuFrame;  // handle to frame menu 
    lParam = (LPARAM) (HMENU) hmenuWindow; // handle to Window menu  
    Parameters
    hmenuFrame 
    Value of wParam. Handle to the new frame window menu. If this parameter is NULL, the frame window menu is not changed. 
    hmenuWindow 
    Value of lParam. Handle to the new Window menu. If this parameter is NULL, the Window menu is not changed. 
    Return Values
    If the message succeeds, the return value is the handle to the old frame window menu.
    If the message fails, the return value is zero. 
    Remarks
    After sending this message, an application must call the DrawMenuBar function to update the menu bar. 
    If this message replaces the Window menu, the MDI child window menu items are removed from the previous Window menu and added to the new Window menu. 
    If an MDI child window is maximized and this message replaces the MDI frame window menu, the window menu icon and restore icon are removed from the previous frame window menu and added to the new frame window menu.

    WM_ENTERSIZEMOVE = H0231;
    The WM_ENTERSIZEMOVE message is sent one time to a window after it enters the moving or sizing modal loop. The window enters the moving or sizing modal loop when the user clicks the window's title bar or sizing border, or when the window passes the WM_SYSCOMMAND message to the DefWindowProc function and the wParam parameter of the message specifies the SC_MOVE or SC_SIZE value. The operation is complete when DefWindowProc returns. 
    The system sends the WM_ENTERSIZEMOVE message regardless of whether the dragging of full windows is enabled. 
    WM_ENTERSIZEMOVE 
    wParam = 0;  // not used, must be zero 
    lParam = 0;  // not used, must be zero  
    Parameters
    This message has no parameters. 
    Return Values
    An application should return zero if it processes this message.

    WM_EXITSIZEMOVE = H0232;
    The WM_EXITSIZEMOVE message is sent one time to a window, after it has exited the moving or sizing modal loop. The window enters the moving or sizing modal loop when the user clicks the window's title bar or sizing border, or when the window passes the WM_SYSCOMMAND message to the DefWindowProc function and the wParam parameter of the message specifies the SC_MOVE or SC_SIZE value. The operation is complete when DefWindowProc returns. 
    WM_EXITSIZEMOVE 
    wParam = 0;  // not used; must be zero 
    lParam = 0;  // not used; must be zero  
    Parameters
    This message has no parameters. 
    Return Values
    An application should return zero if it processes this message.

    WM_DROPFILES = H0233;D0563
    Sent when the user drops a file on the window of an application that has registered itself as a recipient of dropped files. 
    Syntax 
    WM_DROPFILES 
        hDrop = (HANDLE) wParam; 
    Return Values 
    An application should return zero if it processes this message. 
    Parameters 
    hDrop 
    Handle to an internal structure describing the dropped files. This handle is used by the DragFinish, DragQueryFile, and DragQueryPoint functions to retrieve information about the dropped files.

    WM_MDIREFRESHMENU = H0234;
    An application sends the WM_MDIREFRESHMENU message to a multiple document interface (MDI) client window to refresh the Window menu of the MDI frame window. 
    WM_MDIREFRESHMENU 
    wParam = 0; // not used; must be zero 
    lParam = 0; // not used; must be zero  
    Parameters
    This message has no parameters. 
    Return Values
    If the message succeeds, the return value is the handle to the frame window menu.
    If the message fails, the return value is NULL. 
    Remarks
    After sending this message, an application must call the DrawMenuBar function to update the menu bar.

    WM_MOUSEHOVER = H02A1;

    WM_MOUSELEAVE = H02A3;

    WM_CUT = H0300 : D768
    程序发送此消息给一个编辑框或combobox来删除当前选择的文本
    wParam = 0; // not used; must be zero 
    lParam = 0; // not used; must be zero 
    This message does not return a value.

    WM_COPY = H0301 : D769
    程序发送此消息给一个编辑框或combobox来复制当前选择的文本到剪贴板
    wParam = 0; // not used; must be zero 
    lParam = 0; // not used; must be zero 
    This message does not return a value.

    WM_PASTE = H0302 : D770
    程序发送此消息给editcontrol或combobox从剪贴板中得到数据
    wParam = 0; // not used; must be zero 
    lParam = 0; // not used; must be zero 
    This message does not return a value.

    WM_CLEAR = H0303 : D771
    程序发送此消息给editcontrol或combobox清除当前选择的内容;
    wParam = 0; // not used; must be zero 
    lParam = 0; // not used; must be zero 
    This message does not return a value.

    WM_UNDO = H0304 : D772
    程序发送此消息给editcontrol或combobox撤消最后一次操作
    wParam = 0; // not used; must be zero 
    lParam = 0; // not used; must be zero

    WM_RENDERFORMAT = H0305 : D773
    The WM_RENDERFORMAT message is sent to the clipboard owner if it has delayed rendering a specific clipboard format and if an application has requested data in that format. The clipboard owner must render data in the specified format and place it on the clipboard by calling the SetClipboardData function. 
    WM_RENDERFORMAT 
    uFormat = (UINT) wParam;    // clipboard format  
    Parameters
    uFormat 
    Specifies the clipboard format to be rendered. 
    Return Values
    If an application processes this message, it should return zero. 
    Remarks
    When responding to a WM_RENDERFORMAT message, the clipboard owner must not open the clipboard before calling SetClipboardData.

    WM_RENDERALLFORMATS = H0306 : D774
    The WM_RENDERALLFORMATS message is sent to the clipboard owner before it is destroyed, if the clipboard owner has delayed rendering one or more clipboard formats. For the content of the clipboard to remain available to other applications, the clipboard owner must render data in all the formats it is capable of generating, and place the data on the clipboard by calling the SetClipboardData function. 
    WM_RENDERALLFORMATS  
    Parameters
    This message has no parameters. 
    Return Values
    If an application processes this message, it should return zero. 
    Remarks
    When responding to a WM_RENDERALLFORMATS message, the clipboard owner must call the OpenClipboard and EmptyClipboard functions before calling SetClipboardData. 
    When the application returns, the system removes any unrendered formats from the list of available clipboard formats. For information about delayed rendering, see SetClipboardData.

    WM_DESTROYCLIPBOARD = H0307 : D775
    当调用ENPTYCLIPBOARD函数时 发送此消息给剪贴板的所有者
    The WM_DESTROYCLIPBOARD message is sent to the clipboard owner when a call to the EmptyClipboard function empties the clipboard. 
    WM_DESTROYCLIPBOARD  
    Parameters
    This message has no parameters. 
    Return Values
    If an application processes this message, it should return zero.

    WM_DRAWCLIPBOARD = H0308 : D776
    当剪贴板的内容变化时发送此消息给剪贴板观察链的第一个窗口;它允许用剪贴板观察窗口来显示剪贴板的新内容;
    The WM_DRAWCLIPBOARD message is sent to the first window in the clipboard viewer chain when the content of the clipboard changes. This enables a clipboard viewer window to display the new content of the clipboard. 
    WM_DRAWCLIPBOARD  
    Parameters
    This message has no parameters. 
    Remarks
    Only clipboard viewer windows receive this message. These are windows that have been added to the clipboard viewer chain by using the SetClipboardViewer function. 
    Each window that receives the WM_DRAWCLIPBOARD message must call the SendMessage function to pass the message on to the next window in the clipboard viewer chain. The handle of the next window in the chain is returned by SetClipboardViewer, and may change in response to a WM_CHANGECBCHAIN message.

    WM_PAINTCLIPBOARD = H0309 : D777
    当剪贴板包含CF_OWNERDIPLAY格式的数据并且剪贴板观察窗口的客户区需要重画;
    The WM_PAINTCLIPBOARD message is sent to the clipboard owner by a clipboard viewer window when the clipboard contains data in the CF_OWNERDISPLAY format and the clipboard viewer's client area needs repainting. 
    WM_PAINTCLIPBOARD 
    hwndViewer = (HWND) wParam;     // handle of clipboard viewer window 
    hglbPs = (HGLOBAL) lParam;      // handle of PAINTSTRUCT object  
    Parameters
    hwndViewer 
    Value of wParam. Handle to the clipboard viewer window. 
    hglbPs 
    Value of lParam. Handle to a global DDESHARE object that contains aPAINTSTRUCT structure. The structure defines the part of the client area to paint. 
    Return Values
    If an application processes this message, it should return zero. 
    Remarks
    To determine whether the entire client area or just a portion of it needs repainting, the clipboard owner must compare the dimensions of the drawing area given in the rcpaint member of PAINTSTRUCT to the dimensions given in the most recent WM_SIZECLIPBOARD message. 
    The clipboard owner must use the GlobalLock function to lock the memory that contains the PAINTSTRUCT structure. Before returning, the clipboard owner must unlock that memory by using the GlobalUnlock function.

    WM_VSCROLLCLIPBOARD = H030A : D778
    The WM_VSCROLLCLIPBOARD message is sent to the clipboard owner by a clipboard viewer window when the clipboard contains data in the CF_OWNERDISPLAY format and an event occurs in the clipboard viewer's vertical scroll bar. The owner should scroll the clipboard image and update the scroll bar values. 
    WM_VSCROLLCLIPBOARD 
    hwndViewer = (HWND) wParam;         // handle of clipboard viewer window 
    nScrollCode = (int) LOWORD(lParam); // scroll bar code 
    nPos = (int) HIWORD(lParam);        // scroll box position  
    Parameters
    hwndViewer 
    Value of wParam. Handle to the clipboard viewer window. 
    nScrollCode 
    Value of the low-order word of lParam. Specifies a scroll bar event. This parameter can be one of the following values: Value Meaning 
    SB_BOTTOM Scroll to lower right. 
    SB_ENDSCROLL End scroll. 
    SB_LINEDOWN Scroll one line down. 
    SB_LINEUP Scroll one line up. 
    SB_PAGEDOWN Scroll one page down. 
    SB_PAGEUP Scroll one page up. 
    SB_THUMBPOSITION Scroll to absolute position. The current position is specified by the nPos parameter. 
    SB_TOP Scroll to upper left. 
    nPos 
    Value of the high-order word of lParam. Specifies the current position of the scroll box if the nScrollCode parameter is SB_THUMBPOSITION; otherwise, the nPos parameter is not used. 
    Return Values
    If an application processes this message, it should return zero.

    WM_SIZECLIPBOARD = H030B : D779
    当剪贴板包含CF_OWNERDIPLAY格式的数据并且剪贴板观察窗口的客户区域的大小已经改变是此消息通过剪贴板观察窗口发送给剪贴板的所有者;
    The WM_SIZECLIPBOARD message is sent to the clipboard owner by a clipboard viewer window when the clipboard contains data in the CF_OWNERDISPLAY format and the clipboard viewer's client area has changed size. 
    WM_SIZECLIPBOARD 
    hwndViewer = (HWND) wParam;  // handle of clipboard viewer window 
    hglbRc = (HGLOBAL) lParam;   // handle of RECT object  
    Parameters
    hwndViewer 
    Value of wParam. Handle to the clipboard viewer window. 
    hglbRc 
    Value of lParam. Handle to a global memory object that contains aRECT structure. The structure specifies the new dimensions of the clipboard viewer's client area. 
    Remarks
    When the clipboard viewer window is about to be destroyed or resized, a WM_SIZECLIPBOARD message is sent with a null rectangle (0, 0, 0, 0) as the new size. This permits the clipboard owner to free its display resources. 
    The clipboard owner must use the GlobalLock function to lock the memory object that contains RECT. Before returning, the clipboard owner must unlock the object by using the GlobalUnlock function.

    WM_ASKCBFORMATNAME = H030C;
    通过剪贴板观察窗口发送此消息给剪贴板的所有者来请求一个CF_OWNERDISPLAY格式的剪贴板的名字
    The WM_ASKCBFORMATNAME message is sent to the clipboard owner by a clipboard viewer window to request the name of a CF_OWNERDISPLAY clipboard format. 
    WM_ASKCBFORMATNAME 
    cchName = (DWORD) wParam            // size of buffer 
    lpszFormatName = (LPTSTR) lParam    // buffer to receive format name  
    Parameters
    cchName 
    Value of wParam. Specifies the size, in characters, of the buffer pointed to by the lpszFormatName parameter. 
    lpszFormatName 
    Value of lParam. Pointer to the buffer that is to receive the clipboard format name. 
    Return Values
    If an application processes this message, it should return zero. 
    Remarks
    In response to this message, the clipboard owner should copy the name of the owner-display format to the specified buffer, not exceeding the buffer size specified by the cchName parameter. 
    A clipboard viewer window sends this message to the clipboard owner to determine the name of the CF_OWNERDISPLAY format — for example, to initialize a menu listing available formats.

    WM_CHANGECBCHAIN = H030D;
    当一个窗口从剪贴板观察链中移去时发送此消息给剪贴板观察链的第一个窗口;
    The WM_CHANGECBCHAIN message is sent to the first window in the clipboard viewer chain when a window is being removed from the chain. 
    WM_CHANGECBCHAIN 
    hwndRemove = (HWND) wParam;     // handle of window being removed 
    hwndNext = (HWND) lParam;       // handle of next window in chain  
    Parameters
    hwndRemove 
    Value of wParam. Handle to the window being removed from the clipboard viewer chain. 
    hwndNext 
    Value of lParam. Handle to the next window in the chain following the window being removed. This parameter is NULL if the window being removed is the last window in the chain. 
    Return Values
    If an application processes this message, it should return zero. 
    Remarks
    Each clipboard viewer window saves the handle of the next window in the clipboard viewer chain. Initially, this handle is the return value of the SetClipboardViewer function. 
    When a clipboard viewer window receives the WM_CHANGECBCHAIN message, it should call theSendMessage function to pass the message to the next window in the chain, unless the next window is the window being removed. In this case, the clipboard viewer should save the handle specified by hwndNext as the next window in the chain.

    WM_HSCROLLCLIPBOARD = H030E; 
    消息通过一个剪贴板观察窗口发送给剪贴板的所有者 ;它发生在当剪贴板包含CFOWNERDISPALY格式的数据并且有个事件在剪贴板观察窗的水平滚动条上;所有者应滚动剪贴板图象并更新滚动条的值;
    The WM_HSCROLLCLIPBOARD message is sent to the clipboard owner by a clipboard viewer window. This occurs when the clipboard contains data in the CF_OWNERDISPLAY format and an event occurs in the clipboard viewer's horizontal scroll bar. The owner should scroll the clipboard image and update the scroll bar values. 
    WM_HSCROLLCLIPBOARD 
    hwndViewer = (HWND) wParam;         // handle of clipboard viewer window 
    nScrollCode = (int) LOWORD(lParam); // scroll bar code 
    nPos = (int) HIWORD(lParam);        // scroll box position 
     Parameters
    hwndViewer 
    Value of wParam. Handle to the clipboard viewer window. 
    nScrollCode 
    Value of the low-order word of lParam. Specifies a scroll bar event. This parameter can be one of the following values: Value Meaning 
    SB_ENDSCROLL End scroll. 
    SB_LEFT Scroll to upper left. 
    SB_RIGHT Scroll to lower right. 
    SB_LINELEFT Scrolls left by one unit. 
    SB_LINERIGHT Scrolls right by one unit. 
    SB_PAGELEFT Scrolls left by the width of the window. 
    SB_PAGERIGHT Scrolls right by the width of the window. 
    SB_THUMBPOSITION Scroll to absolute position. The current position is specified by the nPos parameter. 
    nPos 
    Value of the high-order word of lParam. Specifies the current position of the scroll box if the nScrollCode parameter is SB_THUMBPOSITION; otherwise, the nPos parameter is not used. 
    Return Values
    If an application processes this message, it should return zero. 
    Remarks
    The clipboard owner can use the ScrollWindow function to scroll the image in the clipboard viewer window and invalidate the appropriate region.

    WM_QUERYNEWPALETTE = H030F;
    消息发送给将要收到焦点的窗口,此消息能使窗口在收到焦点时同时有机会实现他的逻辑调色板
    The WM_QUERYNEWPALETTE message informs a window that it is about to receive the keyboard focus, giving the window the opportunity to realize its logical palette when it receives the focus. 
    WM_QUERYNEWPALETTE  
    Parameters
    This message has no parameters. 
    Return Values
    If the window realizes its logical palette, it must return TRUE; otherwise, it must return FALSE.

    WM_PALETTEISCHANGING= H0310;
    当一个应用程序正要实现它的逻辑调色板时发此消息通知所有的应用程序
    The WM_PALETTEISCHANGING message informs applications that an application is going to realize its logical palette. 
    WM_PALETTEISCHANGING 
    hwndRealize = (HWND) wParam; // window to realize palette 
     Parameters
    hwndRealize 
    Value of wParam. Handle to the window that is going to realize its logical palette. 
    Return Values
    If an application processes this message, it should return zero. 
    Remarks
    The application changing its palette does not wait for acknowledgment of this message before changing the palette and sending the WM_PALETTECHANGED message. As a result, the palette may already be changed by the time an application receives this message. 
    If the application either ignores or fails to process this message and a second application realizes its palette while the first is using palette indexes, there is a strong possibility that the user will see unexpected colors during subsequent drawing operations.

    WM_PALETTECHANGED = H0311;
    消息在一个拥有焦点的窗口实现它的逻辑调色板后发送此消息给所有顶级并重叠的窗口,以此来改变系统调色板 
    The WM_PALETTECHANGED message is sent to all top-level and overlapped windows after the window with the keyboard focus has realized its logical palette, thereby changing the system palette. This message enables a window that uses a color palette but does not have the keyboard focus to realize its logical palette and update its client area. 
    WM_PALETTECHANGED 
    hwndPalChg = (HWND) wParam; // handle of window that changed palette  
    Parameters
    hwndPalChg 
    Value of wParam. Handle to the window that caused the system palette to change. 
    Remarks
    This message must be sent to all top-level and overlapped windows, including the one that changed the system palette. If any child windows use a color palette, this message must be passed on to them as well. 
    To avoid creating an infinite loop, a window that receives this message must not realize its palette, unless it determines that wParam does not contain its own window handle.

    WM_HOTKEY = H0312;
    当用户按下由REGISTERHOTKEY函数注册的热键时提交此消息
    The WM_HOTKEY message is posted when the user presses a hot key registered by the RegisterHotKey function. The message is placed at the top of the message queue associated with the thread that registered the hot key. 
    WM_HOTKEY 
    idHotKey = (int) wParam;              // identifier of hot key 
    fuModifiers = (UINT) LOWORD(lParam);  // key-modifier flags 
    uVirtKey = (UINT) HIWORD(lParam);     // virtual-key code 
     Parameters
    idHotKey 
    Value of wParam. Specifies the identifier of the hot key that generated the message. If the message was generated by a system-defined hot key, the idHotKey parameter will be one of the following values. Value Meaning 
    IDHOT_SNAPDESKTOP The "snap desktop" hot key was pressed. 
    IDHOT_SNAPWINDOW The "snap window" hot key was pressed. 
    fuModifiers 
    Specifies the keys that were to be pressed in combination with the key specified by the nVirtKey parameter to generate the WM_HOTKEY message. The fuModifiers parameter can be a combination of the following values. Value Meaning 
    MOD_ALT Either ALT key was held down. 
    MOD_CONTROL Either CTRL key was held down. 
    MOD_SHIFT Either SHIFT key was held down. 
    MOD_WIN Either WINDOWS key was held down. These keys are labeled with the Microsoft Windows logo. 
    uVirtKey 
    Specifies the virtual key code of the hot key. 
    Remarks
    WM_HOTKEY is unrelated to the WM_GETHOTKEY and WM_SETHOTKEY hot keys. The WM_HOTKEY message is sent for generic hot keys while the WM_SET/GETHOTKEY messages relate to window activation hot keys.

    WM_PRINT = 791;
    应用程序发送此消息仅当WINDOWS或其它应用程序发出一个请求要求绘制一个应用程序的一部分;
    The WM_PRINT message is sent to a window to request that it draw itself in the specified device context, most commonly in a printer device context.
    WM_PRINT 
    hdc = (HDC) wParam; 
    uFlags = lParam;  
    Parameters
    hdc 
    Handle to the device context to draw in. 
    uFlags 
    Specifies the drawing options. This parameter can be one or more of these flags. Value Meaning 
    PRF_CHECKVISIBLE Draw the window only if it is visible. 
    PRF_CHILDREN Draw all visible children windows. 
    PRF_CLIENT Draw the client area of the window. 
    PRF_ERASEBKGND Erase the background before drawing the window. 
    PRF_NONCLIENT Draw the nonclient area of the window. 
    PRF_OWNED Draw all owned windows. 
    Remarks
    TheDefWindowProc function processes this message based on which drawing option is specified: if PRF_CHECKVISIBLE is specified and the window is not visible, do nothing, if PRF_NONCLIENT is specified, draw the nonclient area in the given device context, if PRF_ERASEBKGND is specified, send the window a WM_ERASEBKGND message, if PRF_PRINTCLIENT is specified, send the window a WM_PRINTCLIENT message, if PRF_PRINTCHILDREN is set, send each visible child window a WM_PRINT message, if PRF_OWNED is set, send each visible owned window a WM_PRINT message.

    WM_PRINTCLIENT = 792;
    The WM_PRINTCLIENT message is sent to a window to request that it draw its client area in the specified device context, most commonly in a printer device context.
    WM_PRINTCLIENT 
    hdc = (HDC) wParam; 
    uFlags = lParam;  
    Parameters
    hdc 
    Handle to the device context to draw in. 
    uFlags 
    Specifies drawing options. This parameter can be one or more of these flags. Value Meaning 
    PRF_CHECKVISIBLE Draw the window only if it is visible. 
    PRF_CHILDREN Draw all visible children windows. 
    PRF_CLIENT Draw the client area of the window. 
    PRF_ERASEBKGND Erase the background before drawing the window. 
    PRF_NONCLIENT Draw the nonclient area of the window. 
    PRF_OWNED Draw all owned windows. 
    Remarks
    A window can process this message in much the same manner as WM_PAINT, except that BeginPaint and EndPaint need not be called (a device context is provided), and the window should draw its entire client area rather than just the invalid region.
    Windows that can be used anywhere in the system, such as controls, should process this message. It is probably worthwhile for other windows to process this message as well because it is relatively easy to implement.

    WM_HANDHELDFIRST = 856;

    WM_HANDHELDLAST = 863;

    WM_PENWINFIRST = H0380;

    WM_PENWINLAST = H038F;

    WM_COALESCE_FIRST = H0390;

    WM_COALESCE_LAST = H039F;

    WM_DDE_FIRST = H03E0;

    WM_DDE_INITIATE = WM_DDE_FIRST + 0;
    一个DDE客户程序提交此消息开始一个与服务器程序的会话来响应那个指定的程序和主题名;
    A DDE client application sends a WM_DDE_INITIATE message to initiate a conversation with a server application responding to the specified application and topic names. Upon receiving this message, all server applications with names that match the specified application and that support the specified topic are expected to acknowledge it. (For more information, see the WM_DDE_ACK message.)
    WM_DDE_INITIATE 
    wParam = (WPARAM) hwnd;             // handle of posting appl. 
    lParam = MAKELPARAM(aApp, aTopic);  // appl. and topic atoms  
    Parameters
    hwnd 
    Value of wParam. Handle to the client window sending the message. 
    aApp 
    Value of the low-order word of lParam. Contains an atom that identifies the application with which a conversation is requested. The application name cannot contain slashes (/) or backslashes (/). These characters are reserved for network implementations. If aApp is NULL, a conversation with all applications is requested. 
    aTopic 
    Value of the high-order word of lParam. Contains an atom that identifies the topic for which a conversation is requested. If the topic is NULL, conversations for all available topics are requested. 
    Remarks
    If aApp is NULL, any server application can respond. If aTopic is NULL, any topic is valid. Upon receiving a WM_DDE_INITIATE request with the aTopic parameter set to NULL, a server must send a WM_DDE_ACK message for each of the topics it supports. 
    Sending 
    The client application sends WM_DDE_INITIATE by calling theSendMessage function, not thePostMessage function. The client broadcasts the message to all top-level windows by setting the first parameter of SendMessage to –1. 
    If the client application has already obtained the window handle of the desired server, it can send WM_DDE_INITIATE directly to the server window by passing the server's window handle as the first parameter of SendMessage. 
    The client application allocates aApp and aTopic by calling GlobalAddAtom. 
    When SendMessage returns, the client application must delete the aApp and aTopic atoms. 
    Receiving 
    To complete the initiation of a conversation, the server application must respond with one or more WM_DDE_ACK messages, where each message is for a separate topic. When sending WM_DDE_ACK message, the server should create new aApp and aTopic atoms; it should not reuse the atoms sent with WM_DDE_INITIATE.

    WM_DDE_TERMINATE = WM_DDE_FIRST + 1;
    一个DDE应用程序(无论是客户还是服务器)提交此消息来终止一个会话;
    A DDE application (client or server) posts a WM_DDE_TERMINATE message to terminate a conversation. 
    WM_DDE_TERMINATE 
    wParam = (WPARAM) hwnd; // handle of posting window 
    lParam = 0;             // not used, must be zero  
    Parameters
    hwnd 
    Value of wParam. Handle to the client or server window posting the message. 
    Remarks
    Posting 
    The client or server application posts the WM_DDE_TERMINATE message by calling thePostMessage function, not theSendMessage function. 
    While waiting for confirmation of the termination, the posting application should not post any other messages to the receiving application. If the sending application receives messages (other than WM_DDE_TERMINATE) from the receiving application, it should delete any atoms or shared memory objects accompanying the messages, except hData objects associated with WM_DDE_POKE or WM_DDE_DATA messages that do not have the fRelease flag set. 
    Receiving 
    The client or server application should respond by posting a WM_DDE_TERMINATE message.

    WM_DDE_ADVISE = WM_DDE_FIRST + 2;
    一个DDE客户程序提交此消息给一个DDE服务程序来请求服务器每当数据项改变时更新它
    A DDE client application posts the WM_DDE_ADVISE message to a DDE server application to request the server to supply an update for a data item whenever the item changes. 
    WM_DDE_ADVISE 
    wParam = (WPARAM) hwnd;        // handle of posting application 
    lParam = (LPARAM) lPackedVal;  // packed DDEADVISE and item atom  
    Parameters
    hwnd 
    Value of wParam. Handle to the client window posting the message. 
    lPackedVal 
    Value of lParam. The component parameters packed into lPackedVal are extracted by calling the UnpackDDElParam function. The low-order word is hOptions. The high-order word is aItem. Parameter Description 
    hOptions Handle to a global memory object containing a DDEADVISE structure that specifies how the data is to be sent.  
    aItem Contains an atom that identifies the requested data item. 
    Remarks
    If a client application supports more than one clipboard format for a single topic and item, it can post multiple WM_DDE_ADVISE messages for the topic and item, specifying a different clipboard format with each message. Note that a server can support multiple formats only for hot data links, not warm data links. 
    Posting 
    The client application posts the WM_DDE_ADVISE message by calling thePostMessage function, not theSendMessage function. 
    The client application allocates hOptions by calling the GlobalAlloc function with the GMEM_DDESHARE option. It allocates aItem by calling the GlobalAddAtom function. 
    The client application must create or reuse the WM_DDE_ADVISE lPackedVal parameter by calling the PackDDElParam function or the ReuseDDElParam function with hOptions supplied as the low-order word and aItem supplied as the high-order word. 
    If the receiving (server) application responds with a negative WM_DDE_ACK message, the posting (client) application must delete the hOptions object. 
    The fRelease flag is not used in WM_DDE_ADVISE messages, but their data-freeing behavior is similar to that of WM_DDE_DATA and WM_DDE_POKE messages where fRelease is TRUE. 
    Receiving 
    The server application posts the WM_DDE_ACK message to respond positively or negatively. When posting WM_DDE_ACK, the application can reuse the aItem atom or delete it and create a new one. If the WM_DDE_ACK message is positive, the application should delete the hOptions object; otherwise, the application should not delete the object. 
    The server must create or reuse the WM_DDE_ACK lPackedVal parameter by calling the PackDDElParam function or the ReuseDDElParam function with wStatus supplied as the low-order word and aItem supplied as the high-order word.

    WM_DDE_UNADVISE = WM_DDE_FIRST + 3;
    一个DDE客户程序通过此消息通知一个DDE服务程序不更新指定的项或一个特殊的剪贴板格式的项
    A DDE client application posts a WM_DDE_UNADVISE message to inform a DDE server application that the specified item or a particular clipboard format for the item should no longer be updated. This terminates the warm or hot data link for the specified item. 
    WM_DDE_UNADVISE 
    wParam = (WPARAM) hwnd;        // handle of posting application 
    lParam = (LPARAM) lParam;      // format and item atom  
    Parameters
    hwnd 
    Value of wParam. Handle to the client window sending the message. 
    lParam 
    Holds the cfFormat and aItem parameters. Parameter Description 
    cfFormat This is the LOWORD of lParam. Specifies the clipboard format of the item for which the update request is being retracted. If cfFormat is NULL, all active WM_DDE_ADVISE conversations for the item are to be terminated. 
    aItem This is the HIWORD of lParam. Contains a global atom that identifies the item for which the update request is being retracted. When aItem is NULL, all active WM_DDE_ADVISE links associated with the conversation are to be terminated. 
    Remarks
    Posting 
    The client application posts the WM_DDE_UNADVISE message by calling thePostMessage function, not theSendMessage function. 
    The client application allocates aItem by calling the GlobalAddAtom function. 
    Receiving 
    The server application posts the WM_DDE_ACK message to respond positively or negatively. When posting WM_DDE_ACK, the server can either reuse the aItem atom, or it can delete the atom and create a new one.

    WM_DDE_ACK = WM_DDE_FIRST + 4;
    消息通知一个DDE(动态数据交换)程序已收到并正在处理WM_DDE_POKE, WM_DDE_EXECUTE, WM_DDE_DATA, WM_DDE_ADVISE, WM_DDE_UNADVISE, or WM_DDE_INITIAT消息
    The WM_DDE_ACK message notifies a DDE application of the receipt and processing of a WM_DDE_POKE, WM_DDE_EXECUTE, WM_DDE_DATA, WM_DDE_ADVISE, WM_DDE_UNADVISE, or WM_DDE_INITIATE message, and in some cases, of a WM_DDE_REQUEST message. 
    WM_DDE_ACK 
    // Response to WM_DDE_INITIATE 
    wParam = (WPARAM) hwnd;          // handle of posting application 
    lParam = MAKELPARAM(aApp, aTopic) // application and topic atoms 
    // Response to WM_DDE_EXECUTE 
    wParam = (WPARAM) hwnd;         // handle of posting application 
    lParam = (LPARAM) lPackedVal;   // packed status flags and data handle 
    // Response to all other messages 
    wParam = (WPARAM) hwnd;         // handle of posting application 
    lParam = (LPARAM) lPackedVal;   // packed status flags and item 
     Parameters
    When responding to WM_DDE_INITIATE: 
    hwnd 
    Value of wParam. Handle to the server window posting the message. 
    aApp 
    Value of the low-order word of lParam. Contains an atom that identifies the replying application. 
    aTopic 
    Value of the high-order word of lParam. Contains an atom that identifies the topic for which a conversation is being established. 
    When responding to WM_DDE_EXECUTE: 
    hwnd 
    Value of wParam. Handle to the server window posting the message. 
    lPackedVal 
    Value of lParam. The component parameters that are packed into lPackedVal are extracted by calling the UnpackDDElParam function. The low-order word is wStatus. The high-order word is the same hCommands that was received in the WM_DDE_EXECUTE message. Parameter Description 
    wStatus Specifies a DDEACK structure containing a series of flags that indicate the status of the response.  
    hCommands Handle to a global memory object that contains the command string. 
    When replying to all other messages: 
    hwnd 
    Value of wParam. Handle to the client or server window posting the message. 
    lPackedVal 
    Value of lParam. The component parameters that are packed into lPackedVal are extracted by calling the UnpackDDElParam function. The low-order word is wStatus. The high-order word is aItem. Parameter Description 
    wStatus Specifies a DDEACK structure containing a series of flags that indicate the status of the response.  
    aItem Contains a global atom that identifies the name of the data item for which the response is sent. 
    Remarks
    Posting
    Except in response to the WM_DDE_INITIATE message, the application posts the WM_DDE_ACK message by calling thePostMessage function, not by calling theSendMessage function. When responding to WM_DDE_INITIATE, the application sends the WM_DDE_ACK message by calling SendMessage. In this case, neither the application-name atom nor the topic-name atom should be NULL (even if the WM_DDE_INITIATE message specified NULL atoms). 
    When acknowledging any message with an accompanying aItem atom, the application posting WM_DDE_ACK can either reuse the aItem atom that accompanied the original message, or it can delete it and create a new one. 
    When acknowledging WM_DDE_EXECUTE, the application that posts WM_DDE_ACK should reuse the global memory object identified in the original WM_DDE_EXECUTE message. 
    All posted WM_DDE_ACK messages must create or reuse the lPackedVal parameter by calling the PackDDElParam function or the ReuseDDElParam function. 
    If an application has initiated the termination of a conversation by posting WM_DDE_TERMINATE and is awaiting confirmation, the waiting application should not acknowledge (positively or negatively) any subsequent messages sent by the other application. The waiting application should delete any atoms or shared memory objects received in these intervening messages. Memory objects should not be freed if the fRelease flag is set to FALSE in WM_DDE_POKE, and WM_DDE_DATA messages. 
    Receiving 
    The application that receives a WM_DDE_ACK message should delete all atoms accompanying the message. If the application receives a WM_DDE_ACK in response to a message with an accompanying hData object, and the object was sent with the fRelease flags set to FALSE, the application is responsible for deleteing the hData object. 
    If the application receives a negative WM_DDE_ACK message posted in reply to a WM_DDE_ADVISE message, the application should delete the global memory object posted with the original WM_DDE_ADVISE message (in hOptions). If the application receives a negative WM_DDE_ACK message posted in reply to a WM_DDE_DATA, WM_DDE_POKE, or WM_DDE_EXECUTE message, the application should delete the global memory object posted with the original WM_DDE_DATA, WM_DDE_POKE, or WM_DDE_EXECUTE message (in hCommands). 
    The application that receives a posted WM_DDE_ACK message must free the lPackedVal parameter by using the FreeDDElParam function.

    WM_DDE_DATA = WM_DDE_FIRST + 5;
    一个DDE服务程序提交此消息给DDE客户程序来传递个一数据项给客户或通知客户的一条可用数据项
    A DDE server application posts a WM_DDE_DATA message to a DDE client application to pass a data item to the client or to notify the client of the availability of a data item. 
    WM_DDE_DATA 
    wParam = (WPARAM) hwnd;         // handle of posting application 
    lParam = (LPARAM) lPackedVal;   // packed DDEDATA and item atom 
    Parameters
    hwnd 
    Value of wParam. Handle to the server window posting the message. 
    lPackedVal 
    Value of lParam. The component parameters that are packed into lPackedVal are extracted by calling the UnpackDDElParam function. The low-order word is hData or NULL. The high-order word is aItem. Parameter Description 
    hData Handle to a global memory object containing a DDEDATA structure with the data and additional information. The handle should be set to NULL if the server is notifying the client that the data-item value has changed during a warm data link. A warm link is established by the client sending a WM_DDE_ADVISE message with the fDeferUpd bit set. 
    aItem Contains an atom that identifies the data item for which the data or notification is sent. 
    Remarks
    Posting 
    The server application posts the WM_DDE_DATA message by calling thePostMessage function, not theSendMessage function. 
    The server application allocates hData by calling the GlobalAlloc function with the GMEM_DDESHARE option. It allocates aItem by calling the GlobalAddAtom function. 
    The server must create or reuse the WM_DDE_DATA lPackedVal parameter by calling the PackDDElParam function or the ReuseDDElParam function with hData supplied as the low-order word and aItem supplied as the high-order word. 
    If the receiving (client) application responds with a negative WM_DDE_ACK message, the posting (server) application must delete the hData object; otherwise, the client must delete the hData object after extracting its contents by calling the UnpackDDElParam function. 
    If the server application sets the fRelease member of the DDEDATA structure to FALSE, the server is responsible for deleting hData upon receiving either a positive or negative acknowledgement. 
    The server application should not set both the fAckReq and fRelease members of the DDEDATA structure to FALSE. If both members are set to FALSE, it is impossible for the server to determine when to delete hData. 
    Receiving 
    If fAckReq is TRUE, the client application should post the WM_DDE_ACK message to respond positively or negatively. When posting WM_DDE_ACK, the client can either reuse the aItem atom, or it can delete it and create a new one. 
    The client must create or reuse the WM_DDE_ACK lPackedVal parameter by calling the PackDDElParam function or the ReuseDDElParam function with wStatus supplied as the low-order word and aItem supplied as the high-order word. 
    If fAckReq is FALSE, the client application should delete the aItem atom. 
    If the posting (server) application specified hData as NULL, the receiving (client) application can request the server to send the data by posting a WM_DDE_REQUEST message. 
    After processing a WM_DDE_DATA message in which hData is not NULL, the client should free hData, unless one of the following conditions is true: 
    The fRelease member is FALSE. 
    The fRelease member is TRUE, but the client application responds with a negative WM_DDE_ACK message.

    WM_DDE_REQUEST = WM_DDE_FIRST + 6;
    一个DDE客户程序提交此消息给一个DDE服务程序来请求一个数据项的值;
    A DDE client application posts a WM_DDE_REQUEST message to a DDE server application to request the value of a data item. 
    WM_DDE_REQUEST 
    wParam = (WPARAM) hwnd;        // handle of posting application 
    lParam = (LPARAM) lParam;      // holds cfFormat and aItem  
    Parameters
    hwnd 
    Value of wParam. Handle to the client window sending the message. 
    lParam 
    Holds the cfFormat and aItem parameters. Parameter Description 
    cfFormat This is the LOWORD of lParam. Specifies a standard or registered clipboard format. 
    aItem This is the HIWORD of lParam. Contains an atom that identifies the data item requested from the server. 
    Remarks
    Posting 
    The client application posts the WM_DDE_REQUEST message by calling thePostMessage function, not theSendMessage function. 
    The client application allocates aItem by calling the GlobalAddAtom function. 
    Receiving 
    If the receiving (server) application can satisfy the request, it responds with a WM_DDE_DATA message containing the requested data. Otherwise, it responds with a negative WM_DDE_ACK message. 
    When responding with either a WM_DDE_DATA or WM_DDE_ACK message, the server application can either reuse the aItem atom or it can delete the atom and create a new one.

    WM_DDE_POKE = WM_DDE_FIRST + 7;
    一个DDE客户程序提交此消息给一个DDE服务程序,客户使用此消息来请求服务器接收一个未经同意的数据项;服务器通过答复WM_DDE_ACK消息提示是否它接收这个数据项;
    A DDE client application posts a WM_DDE_POKE message to a DDE server application. A client uses this message to request the server to accept an unsolicited data item. The server is expected to reply with a WM_DDE_ACK message indicating whether it accepted the data item. 
    WM_DDE_POKE 
    wParam = (WPARAM) hwnd;        // handle of posting application 
    lParam = (LPARAM) lPackedVal;  // packed DDEPOKE and item atom  
    Parameters
    hwnd 
    Value of wParam. Handle to the client window posting the message. 
    lPackedVal 
    Value of lParam. The component parameters that are packed into lPackedVal are extracted by calling the UnpackDDElParam function. The low-order word is hData. The high-order word is aItem. Parameter Description 
    hData Handle to a global memory object containing a DDEPOKE structure with the data and additional information.  
    aItem Contains a global atom that identifies the data item for which the data or notification is being sent. 
    Remarks
    Posting 
    The client application posts the WM_DDE_POKE message by using thePostMessage function. 
    The client application must allocate memory for the hData object by using the GlobalAlloc function with the GMEM_DDESHARE option. The client application must delete the hData object if either of the following conditions is true: 
    The server application responds with a negative WM_DDE_ACK message. 
    The fRelease member is FALSE, but the server application responds with either a positive or negative WM_DDE_ACK. 
    The client application must create the aItem atom by using the GlobalAddAtom function. 
    The client application must create or reuse the WM_DDE_POKE lPackedVal parameter by calling the PackDDElParam function or the ReuseDDElParam function with hData supplied as the low-order word and aItem supplied as the high-order word. 
    Receiving 
    The server application should post the WM_DDE_ACK message to respond positively or negatively. When posting WM_DDE_ACK, the server can either reuse the aItem atom, or it can delete it and create a new one. 
    The server must create or reuse the WM_DDE_ACK lPackedVal parameter by calling the PackDDElParam function or the ReuseDDElParam function with wStatus supplied as the low-order word and aItem supplied as the high-order word. 
    To free the hData object, the server should call the GlobalFree function. Also, if the data format is either CF_DSPMETAFILEPICT or CF_METAFILEPICT, the server must also call DeleteMetaFile with the embedded metafile handle. These two formats have an extra level of indirection; that is, an application must lock hData to get a pointer to a handle, then lock that handle to get a pointer to a METAFILEPICT structure, and finally call DeleteMetaFile with the handle from the hMF member of the METAFILEPICT structure. 
    To free the lPackedVal object, the server should call the FreeDDElParam function.

    WM_DDE_EXECUTE = WM_DDE_FIRST + 8;
    一个DDE客户程序提交此消息给一个DDE服务程序来发送一个字符串给服务器让它象串行命令一样被处理,服务器通过提交WM_DDE_ACK消息来作回应;
    A DDE client application posts a WM_DDE_EXECUTE message to a DDE server application to send a string to the server to be processed as a series of commands. The server application is expected to post a WM_DDE_ACK message in response. 
    WM_DDE_EXECUTE 
    wParam = (WPARAM) hwnd;        // handle of posting application 
    lParam = (LPARAM) hCommands;   // handle to global object  
    Parameters
    hwnd 
    Value of wParam. Handle to the client window posting the message. 
    hCommands 
    Value of lParam. Contains a global memory object that references an ANSI or Unicode command string, depending on the types of windows involved in the conversation. 
    Remarks
    The command string is a null-terminated string consisting of one or more opcode strings enclosed in single brackets ([ ]). 
    Each opcode string has the following syntax, where the parameters list is optional: 
    opcode parameters 
    The opcode is any application-defined single token. It cannot include spaces, commas, parentheses, brackets, or quotation marks. 
    The parameters list can contain any application-defined value or values. Multiple parameters are separated by commas, and the entire parameter list is enclosed in parentheses. Parameters cannot include commas or parentheses except inside a quoted string. If a bracket or parenthesis character is to appear in a quoted string, it need not be doubled, as was the case under the old rules. 
    Following are some valid command strings: 
    [connect][download(query1,results.txt)][disconnect] 
    [query("sales per employee for each district")] 
    [open("sample.xlm")][run("r1c1")] 
    [quote_case("This is a "" character")] 
    [bracket_or_paren_case("()s or []s should be no problem.")] 
     Note that, under the old rules, parentheses and brackets had to be doubled, as follows: 
    [bracket_or_paren_case("(())s or [[]]s should be no problem.")] 
     Servers should be able to parse commands in either form. 
    Unicode execute strings should be used only when both the client and server window handles cause theIsWindowUnicode function to return TRUE. 
    Posting 
    The client application posts the WM_DDE_EXECUTE message by calling thePostMessage function, not theSendMessage function. 
    The client application allocates hCommands by calling the GlobalAlloc function with the GMEM_DDESHARE option. 
    When processing the WM_DDE_ACK message that the server posts in reply to a WM_DDE_EXECUTE message, the client application must delete the hCommands object sent back in the WM_DDE_ACK message. 
    Receiving 
    The server application posts the WM_DDE_ACK message to respond positively or negatively. The server should reuse the hCommands object. 
    Unless specified otherwise by a sub-protocol, the server should not post the WM_DDE_ACK message until all the actions specified by the execute command string are completed. The one exception to this rule is when the string causes the server to terminate the conversation.

    WM_DDE_LAST = WM_DDE_FIRST + 8;

    WM_APP = H8000;

    WM_USER = H0400;
    消息能帮助应用程序自定义私有消息

     

    通知消息(Notification message)是指这样一种消息,一个窗口内的子控件发生了一些事情,需要通知父窗口。通知消息只适用于标准的窗口控件如按钮、列表框、组合框、编辑框,以及Windows 95公共控件如树状视图、列表视图等。例如,单击或双击一个控件、在控件中选择部分文本、操作控件的滚动条都会产生通知消息

    一、Child Window Notification Window(标准的窗口控件WM_COMMAND通知消息)通知消息映射
    1.Generic Control 消息消息映射
    ON_CONTROL( <wNotifyCode>, <id>, <memberFxn> ) afx_msg void memberFxn( ); 
    ON_CONTROL_RANGE(wNotifyCode, id1, id2, memberFxn ) afx_msg void memberFxn(UINT nID)

    2.按扭
    BN_CLICKED //用户单击了按钮
    BN_DISABLE //按钮被禁止
    BN_DOUBLECLICKED //用户双击了按钮
    BN_HILITE //用户加亮了按钮
    BN_PAINT按钮应当重画
    BN_UNHILITE加亮应当去掉

    ON_BN_CLICKED( <id>, <memberFxn> ) afx_msg void memberFxn( ); 
    ON_BN_DISABLE( <id>, <memberFxn> ) afx_msg void memberFxn( ); 
    ON_BN_DOUBLECLICKED( <id>, <memberFxn> ) afx_msg void memberFxn( ); 
    ON_BN_HILITE( <id>, <memberFxn> ) afx_msg void memberFxn( ); 
    ON_BN_PAINT( <id>, <memberFxn> ) afx_msg void memberFxn( ); 
    ON_BN_UNHILITE( <id>, <memberFxn> ) afx_msg void memberFxn( );

    3.组合框
    CBN_CLOSEUP组合框的列表框被关闭
    CBN_DBLCLK用户双击了一个字符串
    CBN_DROPDOWN组合框的列表框被拉出
    The CBN_DROPDOWN notification message is sent when the list box of a combo box is about to be made visible. The parent window of the combo box receives this notification message through the WM_COMMAND message. 
    CBN_DROPDOWN 
    idComboBox = (int) LOWORD(wParam);  // identifier of combo box 
    hwndComboBox = (HWND) lParam;       // handle to combo box  
    Remarks
    This notification message can occur only for a combo box with the CBS_DROPDOWN or CBS_DROPDOWNLIST style. 
    CBN_EDITCHANGE用户修改了编辑框中的文本
    CBN_EDITUPDATE编辑框内的文本即将更新
    CBN_ERRSPACE组合框内存不足
    CBN_KILLFOCUS组合框失去输入焦点
    CBN_SELCHANGE在组合框中选择了一项
    CBN_SELENDCANCEL用户的选择应当被取消
    CBN_SELENDOK用户的选择是合法的
    CBN_SETFOCUS组合框获得输入焦点

    ON_CBN_CLOSEUP( <id>, <memberFxn> ) afx_msg void memberFxn( ) 
    ON_CBN_DBLCLK( <id>, <memberFxn> ) afx_msg void memberFxn( ); 
    ON_CBN_DROPDOWN( <id>, <memberFxn> ) afx_msg void memberFxn( ); 
    ON_CBN_EDITCHANGE( <id>, <memberFxn> ) afx_msg void memberFxn( ); 
    ON_CBN_EDITUPDATE( <id>, <memberFxn> ) afx_msg void memberFxn( ); 
    ON_CBN_ERRSPACE( <id>, <memberFxn> ) afx_msg void memberFxn( ); 
    ON_CBN_KILLFOCUS( <id>, <memberFxn> ) afx_msg void memberFxn( ); 
    ON_CBN_SELCHANGE( <id>, <memberFxn> ) afx_msg void memberFxn( ); 
    ON_CBN_SELENDCANCEL( <id>, <memberFxn> ) afx_msg void memberFxn( ); 
    ON_CBN_SELENDOK( <id>, <memberFxn> ) afx_msg void memberFxn( ); 
    ON_CBN_SETFOCUS( <id>, <memberFxn> ) afx_msg void memberFxn( );

    4.编辑框
    EN_CHANGE编辑框中的文本己更新
    EN_ERRSPACE编辑框内存不足
    EN_HSCROLL用户点击了水平滚动条
    EN_KILLFOCUS编辑框正在失去输入焦点
    EN_MAXTEXT插入的内容被截断
    EN_SETFOCUS编辑框获得输入焦点
    EN_UPDATE编辑框中的文本将要更新
    EN_VSCROLL用户点击了垂直滚动条消息含义

    ON_EN_CHANGE( <id>, <memberFxn> ) afx_msg void memberFxn( ); 
    ON_EN_ERRSPACE( <id>, <memberFxn> ) afx_msg void memberFxn( ); 
    ON_EN_HSCROLL( <id>, <memberFxn> ) afx_msg void memberFxn( ); 
    ON_EN_KILLFOCUS( <id>, <memberFxn> ) afx_msg void memberFxn( ); 
    ON_EN_MAXTEXT( <id>, <memberFxn> ) afx_msg void memberFxn( ); 
    ON_EN_SETFOCUS( <id>, <memberFxn> ) afx_msg void memberFxn( ); 
    ON_EN_UPDATE( <id>, <memberFxn> ) afx_msg void memberFxn( ); 
    ON_EN_VSCROLL( <id>, <memberFxn> ) afx_msg void memberFxn( );

    5.列表框
    LBN_DBLCLK用户双击了一项
    LBN_ERRSPACE列表框内存不够
    LBN_KILLFOCUS列表框正在失去输入焦点
    LBN_SELCANCEL选择被取消
    LBN_SELCHANGE选择了另一项
    LBN_SETFOCUS列表框获得输入焦点

    ON_LBN_DBLCLK( <id>, <memberFxn> ) afx_msg void memberFxn( ); 
    ON_LBN_ERRSPACE( <id>, <memberFxn> ) afx_msg void memberFxn( ); 
    ON_LBN_KILLFOCUS( <id>, <memberFxn> ) afx_msg void memberFxn( ); 
    ON_LBN_SELCHANGE( <id>, <memberFxn> ) afx_msg void memberFxn( ); 
    ON_LBN_SETFOCUS( <id>, <memberFxn> ) afx_msg void memberFxn( );

    二、Window消息消息映射
    ON_WM_ACTIVATE( ) afx_msg void OnActivate( UINT, CWnd*, BOOL ); 
    ON_WM_ACTIVATEAPP( ) afx_msg void OnActivateApp( BOOL, HANDLE ); 
    ON_WM_ASKCBFORMATNAME( ) afx_msg void OnAskCbFormatName( UINT, LPSTR ); 
    ON_WM_CANCELMODE( ) afx_msg void OnCancelMode( ); 
    ON_WM_CAPTURECHANGED( ) afx_msg void OnCaptureChanged( CWnd* ); 
    ON_WM_CHANGECBCHAIN( ) afx_msg void OnChangeCbChain( HWND, HWND ); 
    ON_WM_CHAR( ) afx_msg void OnChar( UINT, UINT, UINT ); 
    ON_WM_CHARTOITEM( ) afx_msg int OnCharToItem( UINT, CWnd*, UINT ); 
    ON_WM_CHILDACTIVATE( ) afx_msg void OnChildActivate( ); 
    ON_WM_CLOSE( ) afx_msg void OnClose( ); 
    ON_WM_COMPACTING( ) afx_msg void OnCompacting( UINT ); 
    ON_WM_COMPAREITEM( ) afx_msg int OnCompareItem( LPCOMPAREITEMSTRUCT ); 
    ON_WM_CONTEXTMENU( ) afx_msg void OnContextMenu( CWnd*, CPoint ); 
    ON_WM_COPYDATA( ) afx_msg BOOL OnCopyData( CWnd* pWnd, COPYDATASTRUCT* pCopyDataStruct ); 操作系统维护一块内存来管理 WM_COPYDATA 消息,该消息主要用于跨进程传递数据
    ON_WM_CREATE( ) afx_msg int OnCreate( LPCREATESTRUCT ); 
    ON_WM_CTLCOLOR( ) afx_msg HBRUSH OnCtlColor( CDC*, CWnd*, UINT ); 
    ON_WM_DEADCHAR( ) afx_msg void OnDeadChar( UINT, UINT, UINT ); 
    ON_WM_DELETEITEM( ) afx_msg void OnDeleteItem( LPDELETEITEMSTRUCT ); 
    ON_WM_DESTROY( ) afx_msg void OnDestroy( ); 
    ON_WM_DESTROYCLIPBOARD( ) afx_msg void OnDestroyClipboard( ); 
    ON_WM_DEVICECHANGE( ) afx_msg void OnDeviceChange( UINT, DWORD ); 
    ON_WM_DEVMODECHANGE( ) afx_msg void OnDevModeChange( LPSTR ); 
    ON_WM_DRAWCLIPBOARD( ) afx_msg void OnDrawClipboard( ); 
    ON_WM_DRAWITEM( ) afx_msg void OnDrawItem( LPDRAWITEMSTRUCT ); 
    ON_WM_DROPFILES( ) afx_msg void OnDropFiles( HDROP ); 
    ON_WM_ENABLE( ) afx_msg void OnEnable( BOOL ); 
    ON_WM_ENDSESSION( ) afx_msg void OnEndSession( BOOL ); 
    ON_WM_ENTERIDLE( ) afx_msg void OnEnterIdle( UINT, CWnd* ); 
    ON_WM_ERASEBKGND( ) afx_msg BOOL OnEraseBkgnd( CDC * ); 
    ON_WM_FONTCHANGE( ) afx_msg void OnFontChange( ); 
    ON_WM_GETDLGCODE( ) afx_msg UINT OnGetDlgCode( ); 
    ON_WM_GETMINMAXINFO( ) afx_msg void OnGetMinMaxInfo( LPPOINT ); 
    ON_WM_HELPINFO( ) afx_msg BOOL OnHelpInfo( HELPINFO* ); 
    ON_WM_HSCROLL( ) afx_msg void OnHScroll( UINT, UINT, CWnd* ); 
    ON_WM_HSCROLLCLIPBOARD( ) afx_msg void OnHScrollClipboard CWnd*, UINT, UINT ); 
    ON_WM_ICONERASEBKGND( ) afx_msg void OnIconEraseBkgnd( CDC * ); 
    ON_WM_INITMENU( ) afx_msg void OnInitMenu( CMenu * ); 
    ON_WM_INITMENUPOPUP( ) afx_msg void OnInitMenuPopup( CMenu *, UINT, BOOL ); 
    ON_WM_KEYDOWN( ) afx_msg void OnKeyDown( UINT, UINT, UINT ); 
    ON_WM_KEYUP( ) afx_msg void OnKeyUp( UINT, UINT, UINT ); 
    ON_WM_KILLFOCUS( ) afx_msg void OnKillFocus( CWnd* ); 
    ON_WM_LBUTTONDBLCLK( ) afx_msg void OnLButtonDblClk( UINT, CPoint ); 
    ON_WM_LBUTTONDOWN( ) afx_msg void OnLButtonDown( UINT, CPoint ); 
    ON_WM_LBUTTONUP( ) afx_msg void OnLButtonUp( UINT, CPoint ); 
    ON_WM_MBUTTONDBLCLK( ) afx_msg void OnMButtonDblClk( UINT, CPoint ); 
    ON_WM_MBUTTONDOWN( ) afx_msg void OnMButtonDown( UINT, CPoint ); 
    ON_WM_MBUTTONUP( ) afx_msg void OnMButtonUp( UINT, CPoint ); 
    ON_WM_MDIACTIVATE( ) afx_msg void OnMDIActivate( BOOL, CWnd*, CWnd* ); 
    ON_WM_MEASUREITEM( ) afx_msg void OnMeasureItem( LPMEASUREITEMSTRUCT ); 
    ON_WM_MENUCHAR( ) afx_msg LONG OnMenuChar( UINT, UINT, CMenu * ); 
    ON_WM_MENUSELECT( ) afx_msg void OnMenuSelect( UINT, UINT, HMENU ); 
    ON_WM_MOUSEACTIVATE( ) afx_msg int OnMouseActivate( CWnd*, UINT, UINT ); 
    ON_WM_MOUSEMOVE( ) afx_msg void OnMouseMove( UINT, CPoint ); 
    ON_WM_MOUSEWHEEL( ) afx_msg BOOL OnMouseWheel( UINT, short, CPoint ); 
    ON_WM_MOVE( ) afx_msg void OnMove( int, int ); 
    ON_WM_MOVING( ) afx_msg void OnMoving( UINT, LPRECT ); 
    ON_WM_NCACTIVATE( ) afx_msg BOOL OnNcActivate( BOOL ); 
    ON_WM_NCCALCSIZE( ) afx_msg void OnNcCalcSize( BOOL, NCCALCSIZE_PARAMS FAR* ); 
    ON_WM_NCCREATE( ) afx_msg BOOL OnNcCreate( LPCREATESTRUCT ); 
    ON_WM_NCDESTROY( ) afx_msg void OnNcDestroy( ); 
    ON_WM_NCHITTEST( ) afx_msg UINT OnNcHitTest( CPoint ); 
    ON_WM_NCLBUTTONDBLCLK( ) afx_msg void OnNcLButtonDblClk( UINT, CPoint ); 
    ON_WM_NCLBUTTONDOWN( ) afx_msg void OnNcLButtonDown( UINT, CPoint ); 
    ON_WM_NCLBUTTONUP( ) afx_msg void OnNcLButtonUp( UINT, CPoint ); 
    ON_WM_NCMBUTTONDBLCLK( ) afx_msg void OnNcMButtonDblClk( UINT, CPoint ); 
    ON_WM_NCMBUTTONDOWN( ) afx_msg void OnNcMButtonDown( UINT, CPoint ); 
    ON_WM_NCMBUTTONUP( ) afx_msg void OnNcMButtonUp( UINT, CPoint ); 
    ON_WM_NCMOUSEMOVE( ) afx_msg void OnNcMouseMove( UINT, CPoint ); 
    ON_WM_NCPAINT( ) afx_msg void OnNcPaint( ); 
    ON_WM_NCRBUTTONDBLCLK( ) afx_msg void OnNcRButtonDblClk( UINT, CPoint ); 
    ON_WM_NCRBUTTONDOWN( ) afx_msg void OnNcRButtonDown( UINT, CPoint ); 
    ON_WM_NCRBUTTONUP( ) afx_msg void OnNcRButtonUp( UINT, CPoint ); 
    ON_WM_PAINT( ) afx_msg void OnPaint( ); 
    ON_WM_PAINTCLIPBOARD( ) afx_msg void OnPaintClipboard( CWnd*, HANDLE ); 
    ON_WM_PALETTECHANGED( ) afx_msg void OnPaletteChanged( CWnd* ); 
    ON_WM_PALETTEISCHANGING( ) afx_msg void OnPaletteIsChanging( CWnd* ); 
    ON_WM_PARENTNOTIFY( ) afx_msg void OnParentNotify( UINT, LONG ); 
    ON_WM_QUERYDRAGICON( ) afx_msg HCURSOR OnQueryDragIcon( ); 
    ON_WM_QUERYENDSESSION( ) afx_msg BOOL OnQueryEndSession( ); 
    ON_WM_QUERYNEWPALETTE( ) afx_msg BOOL OnQueryNewPalette( ); 
    ON_WM_QUERYOPEN( ) afx_msg BOOL OnQueryOpen( ); 
    ON_WM_RBUTTONDBLCLK( ) afx_msg void OnRButtonDblClk( UINT, CPoint ); 
    ON_WM_RBUTTONDOWN( ) afx_msg void OnRButtonDown( UINT, CPoint ); 
    ON_WM_RBUTTONUP( ) afx_msg void OnRButtonUp( UINT, CPoint ); 
    ON_WM_RENDERALLFORMATS( ) afx_msg void OnRenderAllFormats( ); 
    ON_WM_RENDERFORMAT( ) afx_msg void OnRenderFormat( UINT ); 
    ON_WM_SETCURSOR( ) afx_msg BOOL OnSetCursor( CWnd*, UINT, UINT ); 
    ON_WM_SETFOCUS( ) afx_msg void OnSetFocus( CWnd* ); 
    ON_WM_SHOWWINDOW( ) afx_msg void OnShowWindow( BOOL, UINT ); 
    ON_WM_SIZE( ) afx_msg void OnSize( UINT, int, int ); 
    ON_WM_SIZECLIPBOARD( ) afx_msg void OnSizeClipboard( CWnd*, HANDLE ); 
    ON_WM_SIZING( ) afx_msg void OnSizing( UINT, LPRECT );  
    ON_WM_SPOOLERSTATUS( ) afx_msg void OnSpoolerStatus( UINT, UINT ); 
    ON_WM_STYLECHANGED( ) afx_msg void OnStyleChanged( int, LPSTYLESTRUCT ); 
    ON_WM_STYLECHANGING( ) afx_msg void OnStyleChanging( int, LPSTYLESTRUCT ); 
    ON_WM_SYSCHAR( ) afx_msg void OnSysChar( UINT, UINT, UINT ); 
    ON_WM_SYSCOLORCHANGE( ) afx_msg void OnSysColorChange( ); 
    ON_WM_SYSCOMMAND( ) afx_msg void OnSysCommand( UINT, LONG ); 
    ON_WM_SYSDEADCHAR( ) afx_msg void OnSysDeadChar( UINT, UINT, UINT ); 
    ON_WM_SYSKEYDOWN( ) afx_msg void OnSysKeyDown( UINT, UINT, UINT ); 
    ON_WM_SYSKEYUP( ) afx_msg void OnSysKeyUp( UINT, UINT, UINT ); 
    ON_WM_TCARD( ) afx_msg void OnTCard( UINT, DWORD ); 
    ON_WM_TIMECHANGE( ) afx_msg void OnTimeChange( ); 
    ON_WM_TIMER( ) afx_msg void OnTimer( UINT ); 
    ON_WM_VKEYTOITEM( ) afx_msg int OnVKeyToItem( UINT, CWnd*, UINT ); 
    ON_WM_VSCROLL( ) afx_msg void OnVScroll( UINT, UINT, CWnd* ); 
    ON_WM_VSCROLLCLIPBOARD( ) afx_msg void OnVScrollClipboard( CWnd*, UINT, UINT ); 
    ON_WM_WINDOWPOSCHANGED( ) afx_msg void OnWindowPosChanged( WINDOWPOS* lpwndpos ); 
    ON_WM_WINDOWPOSCHANGING( ) afx_msg void OnWindowPosChanging( WINDOWPOS* lpwndpos ); 
    ON_WM_WININICHANGE( ) afx_msg void OnWinIniChange( LPSTR );

    三、命令消息映射
    ON_COMMAND(<id>, <memberFxn>) afx_msg void memberFxn( ); 
    ON_COMMAND_EX(<id>, <memberFxn>) afx_msg BOOL memberFxn(UINT nID);
    ON_COMMAND_RANGE(nID,nLastID,pfn) afx_msg void memberFxn(UINT nID)
    ON_UPDATE_COMMAND_UI(<id>, <memberFxn>) afx_msg void memberFxn(CCmdUI* pCmdUI);
    ON_UPDATE_COMMAND_UI_RANGE(nID,nLastID,pfn) afx_msg void memberFxn(CCmdUI* pCmdUI)

    四、WM_COMMAND通知消息映射(只适用于标准的窗口控件):
    ON_CONTROL( <wNotifyCode>, <id>, <memberFxn> ) afx_msg void memberFxn( ); 
    ON_CONTROL_RANGE(wNotifyCode, id1, id2, memberFxn ) afx_msg void memberFxn(UINT nID)

    五、消息映射(只适用于Windows公共控件):
    ON_NOTIFY( wNotifyCode, id, memberFxn ) afx_msg void memberFxn( NMHDR * pNotifyStruct, LRESULT * result );
    ON_NOTIFY_RANGE( wNotifyCode, id, idLast, memberFxn ) afx_msg void memberFxn( UINT id, NMHDR * pNotifyStruct, LRESULT * result );
    ON_NOTIFY_EX( nCode, id, memberFxn ) afx_msg BOOL memberFxn( UINT id, NMHDR * pNotifyStruct, LRESULT * result );
    ON_NOTIFY_EX_RANGE( wNotifyCode, id, idLast, memberFxn ) afx_msg BOOL memberFxn( UINT id, NMHDR * pNotifyStruct, LRESULT * result );

    六、反射消息映射(父窗口处理通知消息WM_CTLCOLOR、WM_COMMAND、WM_NOTIFY时,反射回子控件窗口处理):
    ON_CONTROL_REFLECT( wNotifyCode, memberFxn ) afx_msg void memberFxn(); 
    ON_NOTIFY_REFLECT( wNotifyCode, memberFxn ) afx_msg void memberFxn ( NMHDR * pNotifyStruct, LRESULT* result ); 
    ON_UPDATE_COMMAND_UI_REFLECT( memberFxn ) afx_msg void memberFxn ( CCmdUI* pCmdUI ); 
    ON_WM_CTLCOLOR_REFLECT( ) afx_msg HBRUSH CtlColor ( CDC* pDC, UINT nCtlColor ); 
    ON_WM_DRAWITEM_REFLECT( ) afx_msg void DrawItem ( LPDRAWITEMSTRUCT lpDrawItemStruct ); 
    ON_WM_MEASUREITEM_REFLECT( ) afx_msg void MeasureItem ( LPMEASUREITEMSTRUCT lpMeasureItemStruct ); 
    ON_WM_DELETEITEM_REFLECT( ) afx_msg void DeleteItem ( LPDELETEITEMSTRUCT lpDeleteItemStruct ); 
    ON_WM_COMPAREITEM_REFLECT( ) afx_msg int CompareItem ( LPCOMPAREITEMSTRUCT lpCompareItemStruct ); 
    ON_WM_CHARTOITEM_REFLECT( ) afx_msg int CharToItem ( UINT nKey, UINT nIndex ); 
    ON_WM_VKEYTOITEM_REFLECT( ) afx_msg int VKeyToItem ( UINT nKey, UINT nIndex ); 
    ON_WM_HSCROLL_REFLECT( ) afx_msg void HScroll ( UINT nSBCode, UINT nPos ); 
    ON_WM_VSCROLL_REFLECT( ) afx_msg void VScroll ( UINT nSBCode, UINT nPos ); 
    ON_WM_PARENTNOTIFY_REFLECT( ) afx_msg void ParentNotify ( UINT message, LPARAM lParam );

    ON_NOTIFY_REFLECT_EX( wNotifyCode, memberFxn ) afx_msg BOOL memberFxn ( NMHDR * pNotifyStruct, LRESULT* result ); 
    ON_CONTROL_REFLECT_EX( wNotifyCode, memberFxn ) afx_msg BOOL memberFxn();

    七、自定义的窗口消息映射(至少是WM_USER+100,因为许多控件都使用这一范围的WM_USER消息):
    ON_MESSAGE( <message>, <memberFxn> ) afx_msg LRESULT memberFxn( WPARAM, LPARAM );

    八、注册消息映射(用RegisterWindowMessage函数注册的消息):
    ON_REGISTERED_MESSAGE( <nMessageVariable>, <memberFxn> ) afx_msg LRESULT memberFxn( WPARAM, LPARAM );

    九、线程消息映射(只有继承自CWinThread类才能允许处理线程消息。自定义WM_USER或注册RegisterWindowMessage的消息标记。由PostThreadMessage引发):
    ON_THREAD_MESSAGE( <message>, <memberFxn> ) afx_msg void memberFxn( WPARAM, LPARAM ); 
    ON_REGISTERED_THREAD_MESSAGE( <nMessageVariable>, <memberFxn> ) afx_msg void memberFxn( WPARAM, LPARAM );

     

    转载于:https://www.cnblogs.com/panjun/p/5150459.html

    展开全文
  • 主要介绍了Windows消息传递机制,有助于读者更好的理解windows编程的消息机制,需要的朋友可以参考下
  • windows消息传递机制详解

    千次阅读 2018-01-31 18:06:11
    Windows消息提供了应用程序之间、应用程序与Windows系统之间进行通信的手段。应用程序想要实现的功能由消息来触发,并且靠对消息的响应和处理来完成。必须注意的是,消息并非是抢占性的,无论事件的缓急,总是按照...
  • 消息,就是指Windows发出的一个通知,告诉应用程序某个事情发生了。例如,单击鼠标、改变窗口尺寸、按下键盘上的一个键都会使Windows发送一个消息给应用程序。消息本身是作为一个记录传递给应用程序的,这个记录中...
  • Windows消息机制

    2019-09-28 21:35:02
    Windows消息机制详解 消息是指什么? 消息系统对于一个win32程序来说十分重要,它是一个程序运行的动力源泉。一个消息,是系统定义的一个32位的值,他唯一的定义了一个事件,向 Windows发出一个通知,告诉应用...
  • 资源:Windows系统的消息机制详解

    千次阅读 2009-08-11 07:36:00
    此为设定博文发布时间的试验用文,内容没什么好写的,就分享一个刚上传的资源吧:资源:Windows 系统的消息机制详解
  • Windows的钩子机制详解

    2020-12-31 20:05:00
    了解windows程序设计的人都知道,Windows系统程序的运行是建立在消息传递机制的基础之上的,几乎所有的程序活动都由消息来驱动。钩子机制可以看作是一个消息的中转站,控制系统发出消息的处理和传递。利用钩子,我们...
  • 主要介绍了windows消息和消息队列实例详解,详细讲述了Windows的消息机制与原理,对于深入理解和学习Windows应用程序设计有不错的借鉴价值,需要的朋友可以参考下
  • 1.ring3-windows hook机制详解

    千次阅读 2011-05-28 11:41:00
    WINDOWS消息机制 Windows 系统是以消息处理为其控制机制,系统通过消息为窗口过程( windows procedure)传递输入。系统和应用两者都可以产生消息。 Windows 的消息处理机制为了能在应用程序中监控系统的各种...

空空如也

空空如也

1 2 3 4 5 ... 9
收藏数 173
精华内容 69
关键字:

windows消息机制详解