Login  Register

Re: How to tell if a newt window is maximized?

Posted by GiGurra on Feb 24, 2012; 9:57am
URL: https://forum.jogamp.org/How-to-tell-if-a-newt-window-is-maximized-tp3767837p3772154.html

Also, another reason why the maximized flag is important, is that the size of a maximized window will vary depending on if you have the start menu visible or not. To prove my statements above, I wrote the following small C code.

#include <stdio.h>
#include <stdlib.h>
#include "windows.h"

int main(void) {

        const HWND window = FindWindowA("Notepad", NULL);
        if (window != NULL) {
                RECT rect;
                GetWindowRect(window, &rect);
                printf("\n x: %ld", rect.left);
                printf("\n y: %ld", rect.top);
                printf("\n w: %ld", rect.right - rect.left);
                printf("\n h: %ld", rect.bottom - rect.top);
        }

        return EXIT_SUCCESS;
}