I'm working with some owner drawn buttons and when i find the mouse is in a rect of one of these buttons, i SetCapture then update bitmap, else if it not in the rect i release capture:

invoke PtInRect, addr rect, x, y
.if eax == 1
invoke SetCapture, hBTN_&bmp
invoke putBmp, hwnd, hBMP_&bmp&_O, w, h
invoke ReleaseCapture
jmp @paint

the problem is that when my mouse is over one of these buttons, i cannot exit the program ( i mean alt+f4 fails .... )

any clues on this? is this supposed to happen ? .. i imagine not...
Posted on 2003-04-19 04:45:19 by abc123
quote from msdn
When the mouse is captured, menu hotkeys and other keyboard accelerators do not work.

that pretty much sums it up.
Posted on 2003-04-19 10:51:12 by smurf
I am not convinced that you need to do a Set and Release capture for this.... can you explain why you are currently doing that?
Posted on 2003-04-20 06:26:00 by sluggy
id like to explain, but i cannot as its not my idea, i took it from somewhere else

but without it it doesn't work, buttons never release focus it seems.. ( "down" image stays constant )

Posted on 2003-04-20 06:48:19 by abc123

Its worth testing SetCapture from two mouse messages, WM_LBUTTONDOWN and WM_LBUTTONUP as it shows you how it works. Its easy enough to convert the WM_MOUSEMOVE X Y coordinates and display them on the titlebar so you can see when the mouse is captured or not.

If you get it right, click down on the button, drag the mouse while help down out of the button area and the X Y coordinates should still be displayed and change on the title bar. When you release the capture outside of the button area, it will no longer change when you move the mouse.

the problem is that when my mouse is over one of these buttons, i cannot exit the program ( i mean alt+f4 fails .... )

This is normal as you are exclusively processing the messages of the window that has the capture.


Posted on 2003-04-20 07:18:56 by hutch--
oh... hutch, yes, i understand how it works now, it does the test when the mouse is outside client area, finds its outside, release capture and cannot get any more messages until it comes back in... if it doesn't set catpure it can't know when to release it... ( hence "down" stays shown... )

thank you! ;)
Posted on 2003-04-20 07:24:12 by abc123