GetWindowRect wrong dimensions
-
Hi there, I am having the big problem with getting the area of hwind with routine GetWindowRect. Even Spy++ or his implementation returns rectangle, that is smaller than real area. Its a some special kind of application, I am looking for some alternative to GetWindowRect, or how can I get all the window area programmatically correct.
-
Hi there, I am having the big problem with getting the area of hwind with routine GetWindowRect. Even Spy++ or his implementation returns rectangle, that is smaller than real area. Its a some special kind of application, I am looking for some alternative to GetWindowRect, or how can I get all the window area programmatically correct.
-
The
GetWindowRect
function returns the correct size of any window. If your code is not working then you need to provide more details. -
Could you show your code?
-
Could you show your code?
HWND hwnd = FindWindow("HwndWrapper[PokerClient.exe;;518cf654-e6cb-47c5-9916-be16cbf1e961]", NULL);
GetWindowRect(hwnd, &wr);
AdjustWindowRect(&wr, WS_BORDER, true);As I said its weird behaviour of GetWindowRect Edited code, it was from the last operation when I was trying get also parent window.
-
HWND hwnd = FindWindow("HwndWrapper[PokerClient.exe;;518cf654-e6cb-47c5-9916-be16cbf1e961]", NULL);
GetWindowRect(hwnd, &wr);
AdjustWindowRect(&wr, WS_BORDER, true);As I said its weird behaviour of GetWindowRect Edited code, it was from the last operation when I was trying get also parent window.
lacir wrote:
HWND hwnd = FindWindow("HwndWrapper[PokerClient.exe;;518cf654-e6cb-47c5-9916-be16cbf1e961]", NULL);
GetWindowRect(parrent, &wr);
AdjustWindowRect(&wr, WS_BORDER, true);You call FindWindow but then ignore the value it returns. Then you are using some other value parrent as a windows handle to obtain the window rectangle for. Is it what you want? :confused:
-
HWND hwnd = FindWindow("HwndWrapper[PokerClient.exe;;518cf654-e6cb-47c5-9916-be16cbf1e961]", NULL);
GetWindowRect(hwnd, &wr);
AdjustWindowRect(&wr, WS_BORDER, true);As I said its weird behaviour of GetWindowRect Edited code, it was from the last operation when I was trying get also parent window.
-
lacir wrote:
HWND hwnd = FindWindow("HwndWrapper[PokerClient.exe;;518cf654-e6cb-47c5-9916-be16cbf1e961]", NULL);
GetWindowRect(parrent, &wr);
AdjustWindowRect(&wr, WS_BORDER, true);You call FindWindow but then ignore the value it returns. Then you are using some other value parrent as a windows handle to obtain the window rectangle for. Is it what you want? :confused:
-
This line:
GetWindowRect(parrent, &wr);
Should (probably!) either be:
GetWindowRect(hwnd, &wr);
Or:
GetWindowRect(GetParent(hwnd), &wr);
I don't know... :confused: The OP seems to disappear... :~