[pywin32-bugs] [ pywin32-Bugs-2990983 ] EnumDisplaySettings returns a non-modifiable structure
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: SourceForge.net <no...@so...> - 2010-04-22 17:43:43
|
Bugs item #2990983, was opened at 2010-04-22 12:42 Message generated for change (Comment added) made by emlynmu You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=2990983&group_id=78018 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: win32 Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Emlyn Murphy (emlynmu) Assigned to: Nobody/Anonymous (nobody) Summary: EnumDisplaySettings returns a non-modifiable structure Initial Comment: It appears that the python object returned from EnumDisplaySettings is not modifying the C struct. I am attempting to change the display resolution using ChangeDisplaySettingsEx, which I believe used to work. Here is some sample code demonstrating how I'm attempting to change the resolution of the 2nd monitor to 800x600 (which is a valid mode). ##### winDev = win32api.EnumDisplayDevices(DevNum=1) winSettings = win32api.EnumDisplaySettings(winDev.DeviceName, win32con.ENUM_CURRENT_SETTINGS) print 'Current Resolution: %ix%i' % (winSettings.PelsWidth, winSettings.PelsHeight) winSettings.PelsWidth = 800 winSettings.PelsHeight = 600 print 'Target Resolution: %ix%i' % (winSettings.PelsWidth, winSettings.PelsHeight) win32api.ChangeDisplaySettingsEx(winDev.DeviceName, winSettings) winSettings = win32api.EnumDisplaySettings(winDev.DeviceName, win32con.ENUM_CURRENT_SETTINGS) print 'New Resolution: %ix%i' % (winSettings.PelsWidth, winSettings.PelsHeight) ##### The monitor flickers, but the resolution does not actually change. I have two monitors which are set to different resolutions. If I call EnumDisplaySettings on the first monitor and then I use the returned object to change the settings of the second monitor, it does indeed change the 2nd monitor to match the settings of the first. This is leading me to believe that the following lines are not actually modify the C struct: winSettings.PelsWidth = 800 winSettings.PelsHeight = 600 On the python side of things, PelsWidth and PelsHeight are being modified, but it doesn't seem to be carrying over to the C side. ---------------------------------------------------------------------- >Comment By: Emlyn Murphy (emlynmu) Date: 2010-04-22 13:43 Message: I have confirmed that this exact same code works fine with build 212, but not the current build. I'm not sure what version the bug was introduced in because I just went straight back to the version I was using when this last worked. This solution works fine for me, but the bug is real and makes ChangeDisplaySettingsEx completely unusable. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=2990983&group_id=78018 |