PRB: ChangeDisplaySettings Does Not Reposition Taskbar

This article was previously published under Q306263
This article has been archived. It is offered "as is" and will no longer be updated.
Calls to the ChangeDisplaySettings function are documented as broadcasting a message to reposition all Windows on the Desktop, even when the change is temporary. In Microsoft Windows 2000, sometimes a call to ChangeDisplaySettings results in a new display mode in which the taskbar has not been repositioned.

This can leave the task bar floating somewhere on the screen if the resolution of the desktop is set higher, or can cause the taskbar to disappear from the screen if the new resolution is set lower.
The behavior of ChangeDisplaySettings in Windows 2000 has changed and is inconsistent with the other "products" and the documentation. The Windows 2000 taskbar is only repositioned on the screen when the change in display settings are permanent.
The taskbar can be made to reposition itself by making a call to ChangeDisplaySettings that registers the change as permanent. To make the change permanent, call ChangeDisplaySettings and pass the CDS_UPDATEREGISTRY flag.
This behavior is by design.
In Windows 2000 ChangeDisplaySettings does not cause the taskbar to reposition when the display settings change is temporary. Any change in display settings that is not written to the registry are considered temporary by the taskbar in Windows 2000.

To work around this behavior and have the taskbar repositioned, pass the CDS_UPDATEREGISTRY flag to ChangeDisplaySettings.

This is demonstrated in the following sample code:
lResult = ChangeDisplaySettings ( pNewMode, CDS_UPDATEREGISTRY );				
If the change to the display settings is intended to be temporary, your code must call ChangeDisplaySettings to reset the original display settings by passing the original DEVMODE with the CDS_UPDATEREGISTRY flag.

This change in behavior for Windows 2000 was designed to avoid changes to the taskbar settings that would be caused by games, which typically make temporary changes to the system's display settings.

NOTE: All other versions of Windows behave as documented by the Platform Software Development Kit (SDK).

Article ID: 306263 - Last Review: 10/24/2013 07:24:21 - Revision: 3.3

  • Microsoft Windows 2000 Server
  • Microsoft Windows 2000 Advanced Server
  • Microsoft Windows 2000 Professional Edition
  • Microsoft Windows 2000 Datacenter Server
  • kbnosurvey kbarchive kbdswgdi2003swept kbdisplay kbgdi kbprb KB306263