Download

Getting the list of supported resolutions

I have a slider in a menu for selecting the resolution to apply (I can already apply the resolution, I just don’t know how to populate the slider) and I don’t know how to get that list, does anybody know if there is a way to do this?

This should do the work :slight_smile:


#include <iostream>
#include <Windows.h>

using namespace std;

int main() {
	DEVMODE dm = { 0 };

	dm.dmSize = sizeof(dm);

	for (int iModeNum = 0; EnumDisplaySettings(NULL, iModeNum, &dm) != 0; iModeNum++)
	{
		cout << "Mode #" << iModeNum << " = " << dm.dmPelsWidth << "x" << dm.dmPelsHeight << endl;
	}
}