Search code examples
c++winapiresolutiongdi

How do I get the resolution of a window in C++?


#include <windows.h>

int main()
{
    HDC Window = GetWindowDC(FindWindow(NULL,"Window Example Title"));


    return 0;
}

How could I get the resolution of a window, such as this?


Solution

  • Presumably you mean the available graphics area, which in Windows is called the client area.

    You can use the GetClientRect function to find its current size.

    There is a corresponding GetWindowRect for the window itself.