Ok I am doing some windows API programming that deals with two applications\windows. One window is my program, the other is a games window.

I am building my application to output the coordinates to my applications screen.
The coordinates are to be retrieved and are needs to be relative to the games windows, and not the entire desktop\screen of windows\my computer. I cannot find any functions for doing this.

So basically... When mouse is being moved in the games window whatever the coordinates are of the mouse in the games window is what I need. E.g I just need coords of the games window to wherever the mouse is on that games window only!

So I grab the handler to the games window.. all is good.. but I cant find a function where I can tie in that handler in order to get the coords I need.

HWND myapplication; //this is usually just plain old hwnd or MY applictions handler
HWND GameScreen = FindWindow(0,"Title of the game");
HDC hMyApp = GetDC(myapplication);
HDC hGame = GetDC(GameScreen);
// I see the function GetCursorPosition(&pt); but theres no tie in of this function
// I can use for the handler GameScreen.
// I am looking for a way to GetCursorPosition(GameScreen, &pt); or something that
// takes the handler to the games screen and I can pass in &pt, and retrieve coords
// of the mouse relative ONLY to the GameScreen .. if there is such a function

So no one can answer this question for me ehh??
I have tried both to send mouse clicks to a specified coordinate in a sendmessage\postmessage defining the coordinates in lparam, but it doesnt work,or I couldnt get it to click into the client area of this game!
Any help would be appreciated I am exhausting my resources and I have searched far, wide, and near for this answer and havent found anything to relate to what I am trying to do.

Get the coordinates of the cursor relative to the entire screen.

Then use something like GetWindowRect to grab the coordinates of the game window.

Then from there it should be easy to perform a simple conversion to get the mouse coordinates relative to the game window

Reference: http://msdn.microsoft.com/en-us/library/ms633519(VS.85).aspx