WM_SETFOCUS
WM_LBUTTONDOWN这两个消息到底哪个先到?应该是WM_SETFOCUS才对吧?我猜

解决方案 »

  1.   

    先WM_LBUTTONDOWN,因为你看WM_SETFOCUS的说明,是讲的当你有了键盘焦点后就发这个消息
    WM_LBUTTONDOWN
    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. A window receives this message through its WindowProc function. LRESULT CALLBACK WindowProc(
      HWND hwnd,       // handle to window
      UINT uMsg,       // WM_LBUTTONDOWN
      WPARAM wParam,   // key indicator
      LPARAM lParam    // horizontal and vertical position
    );WM_SETFOCUS
    The WM_SETFOCUS message is sent to a window after it has gained the keyboard focus. A window receives this message through its WindowProc function. LRESULT CALLBACK WindowProc(
      HWND hwnd,       // handle to window
      UINT uMsg,       // WM_SETFOCUS
      WPARAM wParam,   // handle to window (HWND)
      LPARAM lParam    // not used
    );