zoukankan      html  css  js  c++  java
  • PeekMessage() 与 GetMessage() 区别

    function Parameters Return Values
    PeekMessage LPMSG lpMsg,
    pointer to structure for message

    HWND hWnd
    handle to window

    UINT wMsgFilterMin
    first message

    UINT wMsgFilterMax
    last message

    UINT wRemoveMsg
    removal flags
    BOOL

    Remarks 
    If a message is available, the return value is nonzero.
    If no messages are available, the return value is zero.


    function Parameters Return Values
    GetMessage LPMSG lpMsg
    address of structure with message

    HWND hWnd
    handle of window

    UINT wMsgFilterMin
    first message

    UINT wMsgFilterMax
    last message
    BOOL

    Remarks 
    If the function retrieves a message other than WM_QUIT, the return value is nonzero.
    If the function retrieves the WM_QUIT message, the return value is zero.
    If there is an error, the return value is -1. For example, the function fails if hWnd is an invalid window handle or lpMsg is an invalid pointer. To get extended error information, callGetLastError.


    Example

    PeekMessage

     while (!bQuit)
        {
            if (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
            {
                if (msg.message == WM_QUIT)
                {
                    bQuit = TRUE;
                }
                else
                {
                    TranslateMessage (&msg);
                    DispatchMessage (&msg);
                }
            }

    GetMessage

    while (GetMessage(&msg, NULL, 0, 0))
        {
            if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
            {
                TranslateMessage(&msg);
                DispatchMessage(&msg);
            }
        }
  • 相关阅读:
    转--Android中调用webservice的工具类
    转--Android实现ListView过滤功能,继承于BaseAdapter,非ArrayAdapter。
    Kubernetes 1.5 配置dns
    Kubernetes 1.5安装
    HAproxy健康检查的三种方式
    某电商网站线上drbd+heartbeat+nfs配置
    sonarqube代码检测
    Sersync实时同步
    RabbitMQ配置文件
    SVNManager配置
  • 原文地址:https://www.cnblogs.com/laohaozi/p/12538378.html
Copyright © 2011-2022 走看看