rminnich
13 years agoContributor
Suggestion: Check display settings before updating
The help section "Get and set display settings" includes an example function SetDisplay. This function changes the current video settings using Win32.
Prior to the line
SetDisplay = Win32API.ChangeDisplaySettings(dm, 0)
It might be a good idea to check if the display settings are valid. This is possible using SetDisplay = Win32API.ChangeDisplaySettings(dm, 2) and checking that its return value is 0.
Note: the value 2 in the ChangeDisplaySettings call is the value for CDS_TEST. According to the MSDN entry for ChangeDisplaySettings, "Specifying CDS_TEST allows an application to determine which graphics modes are actually valid, without causing the system to change to that graphics mode."
Prior to the line
SetDisplay = Win32API.ChangeDisplaySettings(dm, 0)
It might be a good idea to check if the display settings are valid. This is possible using SetDisplay = Win32API.ChangeDisplaySettings(dm, 2) and checking that its return value is 0.
Note: the value 2 in the ChangeDisplaySettings call is the value for CDS_TEST. According to the MSDN entry for ChangeDisplaySettings, "Specifying CDS_TEST allows an application to determine which graphics modes are actually valid, without causing the system to change to that graphics mode."