Try ScreenToClient
POINT pt;
pt.x = pointerInfo.ptPixelLocation.x;
pt.y = pointerInfo.ptPixelLocation.y;
if (ScreenToClient(hTheWindowYouCareAbout, &pt)) {
// Do something here...
}
题
So, I'm trying to get the client coordinates for my mouseX/mouseY variable on the application window. I am able to get the "screen coordinates", but now I need the "client coordinates".
Part of the code is in the picture. I'm not sure what method to call to get access to the "client coordinates"
Help is greatly appreciated.
解决方案
Try ScreenToClient
POINT pt;
pt.x = pointerInfo.ptPixelLocation.x;
pt.y = pointerInfo.ptPixelLocation.y;
if (ScreenToClient(hTheWindowYouCareAbout, &pt)) {
// Do something here...
}