|
-
April 3rd, 2008, 10:58 AM
#1
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
-
April 3rd, 2008, 04:02 PM
#2
Re: rectangle around windowfrompoint handle
You need to display the rectangle in XOR mode.
Look at ::SetROP2().
Cheers
-
April 3rd, 2008, 07:34 PM
#3
Re: rectangle around windowfrompoint handle
Check out the DrawFocusRect api in Msdn.
-
April 4th, 2008, 06:30 AM
#4
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?
Last edited by chals1; April 4th, 2008 at 06:34 AM.
-
April 4th, 2008, 11:15 AM
#5
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
-
April 4th, 2008, 12:08 PM
#6
Re: rectangle around windowfrompoint handle
 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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|