Qt grabWindow coordinates shifted from GetCursorPos and GetWindowRect

Posted by user1391 on Stack Overflow See other posts from Stack Overflow or by user1391
Published on 2010-04-23T01:04:29Z Indexed on 2010/04/23 1:53 UTC
Read the original article Hit count: 277

Filed under:
|
|
|
|

In Qt, when I use the QPixmap::grabWindow(hwnd,x,y,h,w) function, the coordinates are shifted slightly, when compared to the coordinates using the windows api functions GetCursorPos and GetWindowRect.

i.e. (0,0) from the point of view of GetCursorPos and GetWindowRect is at the very top left of the toolbar at the top of the window.

But (0,0) for QPixmap::grabWindow is more "inside" (i.e. ignoring the window frame).

How can I make these 2 coordinates consistent? Especially since the user might have different thicknesses for the window frame?

© Stack Overflow or respective owner

Related posts about qt

Related posts about c++