Original Post
I'm attempting to get all the possible resolutions for the display device. I'm trying to do it like this, but I'm having problems in the fact that it's not enumerating everything. Doing this, the largest resolution I get is 1280x1024, but when I take a look at the desktop settings I get as high as 2048x1536. What's going on here?
std::vector<std::pair<int,int> > dev_resolution_list;
DEVMODE dev_mode; // to store the device mode in
// get all the possible screen resolutions (using NULL as the string just sets it to the current display device)
for(int mode=0; EnumDisplaySettings(NULL, mode, &dev_mode) != 0; ++mode){
if( !dev_resolution_list.empty() ){
std::pair<int,int> p(dev_mode.dmPelsWidth, dev_mode.dmPelsHeight);
// since we only care about the size of the screen, and not the frequency or anything else,
// only add if we have a unique screen res
int i; // use this to check
for(i=0; i < dev_resolution_list.size(); ++i)
if( p == dev_resolution_list )
break;
// If the resolution is already in the list, then the value of 'i' will be
// less than 'dev_resolution_list.size()'.
// Else if the resolution is NOT present in the list, then the value of 'i' will be
// equal to 'dev_resoltion_list.size()'.
if( i == dev_resolution_list.size() )
dev_resolution_list.push_back( p );
}
// Else we don't have anything yet, so add the first one
else
// add the resolution
dev_resolution_list.push_back( std::pair<int,int>(dev_mode.dmPelsWidth, dev_mode.dmPelsHeight) );
}