rectangle around windowfrompoint handle
Hi
I want to draw a rectangle border around the window returned by windowfrompoint. I use GetWindowRect in that handle and then draw a red rectangle onto getdc(0). Can you tell me how to erase the previous rectangle when user moves mouse over other window. I'm trying to achieve the same effect as in camtasia when selecting the target to capture
Re: rectangle around windowfrompoint handle
You need to display the rectangle in XOR mode.
Look at ::SetROP2().
Cheers
Re: rectangle around windowfrompoint handle
Check out the DrawFocusRect api in Msdn.
Re: rectangle around windowfrompoint handle
Thank you both !! The two ways work fine :
rectangle + setrop2
DrawFocusRect, calling it a second time to remove the same rectangle
I'm facing another problem now that i want to draw onto each window instead of the entire screen.
I make a GetDC over the handle of windowfrompoint but when i draw the rectangle, it doesn't fit to borders. There seems to be an offset between coordinates of GetWindowRect and the hdc ones
Some help please?
Re: rectangle around windowfrompoint handle
I believe that GetWindowRect gets the bounding box for the entire window, where the HDC of a window is just the client area.
Viggy
Re: rectangle around windowfrompoint handle
Quote:
Originally Posted by MrViggy
I believe that GetWindowRect gets the bounding box for the entire window, where the HDC of a window is just the client area.
Viggy
Then i assume i have to get that offset between the rectangles of getclientrect and getwindowrect, and include it when drawing onto hdc ??
Thanks