How do i draw a border around the window the mouse is over? I want to do this so the user knows which window hes getting info about.
Posted on 2001-04-19 18:27:00 by HeroInc
HeroInc, There are 4 things you need to do:- 1) Find out which window the mouse is in. 2) Get the Windows rectangle. 3) Remove the previous rectangle. 4) Draw the Rectangle. Finding out which window the mouse is in is easy for Windows NT, 2K and 98, (this won't work for '95) Call TrackMouseEvent, you can find the details of it on the MS website (you could also search this board, I think it has been talked about before). This will send messages to your window when the mouse enters it, and leaves it, posting WM_MOUSELEAVE etc for you. Alternatively, you can track WM_MOUSEMOVE, and hit test each of your windows in turn, so see which one it is in. Now, when the mouse enters a window you call DrawFocusRect to draw a box around the window, use GetWindowRect to get the rectangle to draw. When the mouse leaves the window call DrawFocusRect again, it's a XOR function, so it will put the window back how it was. If you need something other than a focus style rect use FrameRect, then you'll have to re-draw the window when the mouse leaves. umbongo
Posted on 2001-04-20 05:42:00 by umbongo
In addition, GetCapture and SetCapture have worked for me in tracking the mouse. Shawn
Posted on 2001-04-20 11:44:00 by _Shawn