C# Mouse Move and Click relative to active window?

You need to pinvoke GetWindowRect() to find out where the window is located. So you can adjust x and y by the window position. Visit pinvoke.Net for the declarations.

There thanks for that it seems GetWindowRect is what I need I have visited pinvoke. Net I am just confused as to how to get the window handle could someone give me a pointer. – rs82uk Jan 31 at 22:27 Lots of questions here about that.

Search for EnumWindows, FindWindow, GetClassName, Spy++. – Hans Passant Jan 31 at 22:29 Ive used ui spy on the java app in question and the window comes back as SunAwtDialog but GetWindowRect(SunAwtDialog. HWnd, rct); isnt right – rs82uk Jan 31 at 23:23.

Just subtract the location (relative to the screen) of the window you are targeting.

What you're seeing is indeed the expected behavior. The Cursor. Position property describes the cursor's location in screen coordinates, not relative to your form.

However, every control exposes two handy methods that you can take advantage of to convert between screen coordinates and control coordinates: The Control. PointToClient method computes the location of the specified screen point into client coordinates. Use this to convert from screen coordinates into client coordinates (i.e.

, those relative to your control, such as a form). The Control. PointToScreen method computes the location of the specified client point into scren coordinates.

Use this to convert from client coordinates into screen coordinates.

Try PointToClient and PointToScreen of the control you are trying to find relative points to.

PointToClient method computes the location of the specified screen point into client coordinates. Use this to convert from screen coordinates into client coordinates (i.e. , those relative to your control, such as a form).

PointToScreen method computes the location of the specified client point into scren coordinates. Use this to convert from client coordinates into screen coordinates.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions