Click to See Complete Forum and Search --> : rectangle around windowfrompoint handle
chals1
April 3rd, 2008, 11:58 AM
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
golanshahar
April 3rd, 2008, 05:02 PM
You need to display the rectangle in XOR mode.
Look at ::SetROP2().
Cheers
Arjay
April 3rd, 2008, 08:34 PM
Check out the DrawFocusRect (http://msdn2.microsoft.com/en-us/library/ms534886(VS.85).aspx) api in Msdn.
chals1
April 4th, 2008, 07:30 AM
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?
MrViggy
April 4th, 2008, 12:15 PM
I believe that GetWindowRect gets the bounding box for the entire window, where the HDC of a window is just the client area.
Viggy
chals1
April 4th, 2008, 01:08 PM
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
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.