Как получить размеры окна

Пытаюсь получить размеры окна вот так

WinDef.HWND hwd = User32.INSTANCE.FindWindowA("Counter-Strike: Global Offensive", null);

            User32.INSTANCE.GetWindowRect(hwd, rect);

            gameWidth = rect.right - rect.left;
            gameHeight = rect.bottom - rect.top;

Все время выходит 0 Использую библиотеку jna и этот класс

public interface User32 extends Library {
User32 INSTANCE = (User32) Native.load("user32", User32.class, W32APIOptions.DEFAULT_OPTIONS);

void mouse_event(int a, int b, int c, int d, int damnIwonderifpeopleactuallyreadsthis);

boolean GetClientRect(WinDef.HWND hWnd, WinDef.RECT rect);

int GetCursorPos(WinDef.POINT p);

WinDef.HWND FindWindowA(String lpClassName, String lpWindowName);

long GetForegroundWindow();

boolean GetWindowRect(WinDef.HWND hWnd, WinDef.RECT rect);

}


Ответы (0 шт):