PRB: ChangeDisplaySettings Does Not Reposition Taskbar (306263)



The information in this article applies to:

  • Microsoft Windows 2000 Server
  • Microsoft Windows 2000 Advanced Server
  • Microsoft Windows 2000 Professional
  • Microsoft Windows 2000 Datacenter Server

This article was previously published under Q306263

SYMPTOMS

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.

CAUSE

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.

RESOLUTION

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.

STATUS

This behavior is by design.

MORE INFORMATION

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).

Modification Type:MinorLast Reviewed:4/4/2006
Keywords:kbDSWGDI2003Swept kbdisplay kbGDI kbprb KB306263