How can I detect and draw a border around a control or window currently under the mouse outside my application?

I want to draw a border around the control or window that the mouse is currently over whilst my controlling application is minimised.  I would then want to use the co-ordinates of the border as a parameter to a screen capture application.

Chris Bray
LVL 3
chrisbrayAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CuteBugCommented:
I think this is what you are looking for

http://www.codeproject.com/KB/cs/TeboScreen.aspx
0
Mike TomlinsonMiddle School Assistant TeacherCommented:
0
chrisbrayAuthor Commented:
Hi CuteBug,

No, I am afraid that it isn't.   I have seen that application, and its source, but it does not do what I asked...

I wish to be able to determine which window or control is under the mouse when my application is minimised, and draw a border around it.

Chris Bray
0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

Mike TomlinsonMiddle School Assistant TeacherCommented:
*You'll obviously need to integrate the hook code from your PAQ (or use a Timer).  The crux is to use WindowFromPoint() and GetWindowRect().
0
CuteBugCommented:
Here is a code in MSDN (written in VB)...

http://support.microsoft.com/kb/143045

You need to convert it to C#.
0
chrisbrayAuthor Commented:
Hi IdleMind,

OK, that makes sense.  Given that I can use those API calls to get the required information, how can I then draw the border?

Chris Bray
0
Mike TomlinsonMiddle School Assistant TeacherCommented:
In the PAQ I use ControlPaint.DrawReversibleFrame()...
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
chrisbrayAuthor Commented:
This looks like it will do the job for me - I haven't got it fully working yet but won't have time to complete before this question would expire, so I will award the points now.

Thanks for the answers...
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.