How do I find position of a Win32 control/window relative to its parent window?

The solution is using the combined power of GetWindowRect() and MapWindowPoints(). GetWindowRect() retrieves the coordinates of a window relative to the entire screen area you see on your monitor. We need to convert these absolute coordinates into relative coordinates of our main window area. The MapWindowPoints() transforms the coordinates given relative to one window into … Read more