先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 );
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
);