Reputation: 867
How to determine winapi EnumDisplaySettings
failure? According to MSDN
If the function fails, the return value is zero.
also
Graphics mode indexes start at zero. To obtain information for all of a display device's graphics modes, make a series of calls to EnumDisplaySettings, as follows: Set iModeNum to zero for the first call, and increment iModeNum by one for each subsequent call. Continue calling the function until the return value is zero.
How to determine if returned zero is a failure sign or mode doesnt exist (iModeNum
value too big)?
There's nothing told about GetLastError
. It seems like this winapi doesnt set last error on failure.
Upvotes: 1
Views: 1021
Reputation: 941208
This is typical for GDI api calls, they don't set the GetLastError error code. All you've got is the "it didn't work" return value.
Do note that you must start with iModeNum at 0. If that returns FALSE then you can safely assume there's something drastically wrong with the device name argument. Keep incrementing iModeNum until you get FALSE.
Upvotes: 1