Windows Get Screen Resolution in C

c, mingw, screen-resolution, windows

Solution

Use GetSystemMetrics()

DWORD dwWidth = GetSystemMetrics(SM_CXSCREEN);
DWORD dwHeight = GetSystemMetrics(SM_CYSCREEN);

Problem

Using plain C, (not C++ / C# / Objective-C) how do I get the screen resolution in Windows? My compiler is MingW (not sure if relevant). All solutions I have found online are for C++ or some other C variant.

Original source