is there a way to check if the left/right mouse's button is down while the mouse is outside the
window's rect without a hook?
i wan't a window to close when a left/right button is clicked outside its area.
just like the intellicase window is doing (RadAsm/VC..etc)
Posted on 2003-10-17 17:49:35 by wizzra
I do not know how RadASM's doing that, but you may try to use SetCapture(). Then, on the WM_(L/R)BUTTONDOWN message check if the coordinates (in lParam) are in those returned by GetWindowRect()
Posted on 2003-10-17 19:09:26 by Morris
from what i tried, there was no WM_L/RBUTTONDOWN when the mouse is outside the rectangle, only inside the window's area.

anyone can confirm this? or mabye i need to do other thing?
Posted on 2003-10-17 19:17:29 by wizzra
Have you tried GetKeyState and passing VK_LBUTTON, VK_RBUTTON and VK_MBUTTON, never tried it but can't see why it wouldn't work.
Posted on 2003-10-17 19:27:47 by donkey
Would it work to check WM_ACTIVATE and close the window on deactivation? AFAIK any click outside a window's client area deactivates it...
Posted on 2003-10-17 22:26:01 by sirchess2
Posted on 2003-10-17 22:54:48 by Poimander
Use _TrackMouseEvent instead of TrackMouseEvent (note the leading underscore) it will then be compatible with Windows 95 as long as IE 3.02 is installed. That was the test I was running for my HyperLink control which is based on that API.

You should be aware however that at least in the case of RadASM the API helper is a child of the MDI frame so the dismiss is processed by it's parent. If you were to click on the desktop it would have no effect as the mouse is not being captured.
Posted on 2003-10-17 23:42:39 by donkey
ok this did the trick:


.IF wPrama == FALSE
invoke PostMessage,hWnd,WM_CLOSE,0,0
Posted on 2003-10-18 06:07:00 by wizzra

or you can use a timer and call GetAsyncKeyState() with VK_LBUTTON / VK_RBUTTON / VK_MBUTTON every WM_TIMER to detect a mousebutton.
Posted on 2003-10-18 06:55:18 by Nordwind64