I'm using WM_LBUTTONDOWN and WM_LBUTTONUP to set/reset a boolean variable keeping track on whether the user holds down the left mouse button or not. Normally this works fine except when the user presses the button, moves the pointer outside the window (still keeping the button down) then releasing it. This prevents the WM_LBUTTONUP message to be posted, thus making the program think that the button is still pressed though it isn't.
Is there any message that is sent if the mouse leaves the window area? Or something else that can prevent this bug?
Thankful for any help!