Re: CEdit and WM_LBUTTONUP
On Jul 2, 12:20 pm, Mark Salsbery [MVP]
You may want to review the docs for SetCapture().
"SetCapture captures mouse input either when the mouse is over the capturing
window, or when the mouse button was pressed while the mouse was over the
capturing window and the button is still down."
Microsoft MVP - Visual C++
OK here is the scenario. I'm trying to find out when the user clicks
outside of a CEdit control. To do this I'm calling SetCapture from
within a CEdit derived class when the control gets focus. I do this so
that all messages should be sent to the CEdit. I ReleaseCapture on the
I have placed a trace inside of the WM_LBUTTONUP handler and the
KillFocus handler. I can click outside of the control and I get the
WM_LBUTTONUP notification only once. If I keep clicking after the
first click I get nothing. I never get a notification of KillFocus
either. So the CEdit should still have SetCapture activated.
If I click the CEdit again the whole process repeats. Does anyone know
why I don't get the WM_LBUTTONUP message more than once?
P.S. I've also tried WM_LBUTTONDOWN as well. I've tried both of these
messages from PreTranslateMessage and WindowProc.
Thanks for the reply, but I couldn't get my methods to work out for
me. I decided to switch gears and create a mouse hook. I don't like
this approach, but nothing else is readily apparent. Here is what I
g_hHook = SetWindowsHookEx(WH_MOUSE,
LRESULT CALLBACK MouseCheckerProc(
int nCode, // hook code
WPARAM wParam, // message identifier
LPARAM lParam) // mouse coordinates
if (nCode == HC_ACTION)
MOUSEHOOKSTRUCT *pMH = reinterpret_cast<MOUSEHOOKSTRUCT
//put code here
return ::CallNextHookEx(g_hHook, nCode, wParam, lParam);
....I feel like I cheated but what else could I do. Don't wanna get
fired for not finishing on time :D