What does it mean when a display change is temporary?

Raymond Chen

When you call the ChangeDisplaySettings function, you can pass the CDS_FULLSCREEN flag to indicate that the change is temporary. But if you don’t also save the changes in the registry, how can they be permanent? What does temporary mean? A temporary display change is one that your program has entered because it has gone into a fullscreen mode, a change which it will undo when it releases control of the screen to another program. For example, a fullscreen video may use a temporary display change to display a 320 × 200 video. The change isn’t permanent, since the video player will certainly return the video resolution to its previous setting when the video ends or when the user switches to another program. The window manager and Explorer behave differently in response to temporary as opposed to permanent display changes. If a display change is permanent, the window manager will reposition windows and Explorer will reposition desktop icons so that they all fit on the (new) screen. If they didn’t do this, then windows and icons near the right edge or bottom edge would become inaccessible. Conversely, if you say that the change is temporary, then the window manager and Explorer won’t reposition anything because you said that you’ll set things back when you’re done. If you set the CDS_FULLSCREEN flag incorrectly, you typically see one of two results. If you set the temporary flag when you shouldn’t, then you’ll find that icons have disappeared off-screen and have become inaccessible. That’s because you said, “Oh, don’t worry about this screen resolution change. I’ll set it back before you even realize it.” If you fail to set the temporary flag when you should have, then you’ll find that all your open windows and your desktop icons have been squished into the corner of the screen. And that’s because you said, “The user is going to be working in screen resolution to 320 × 200, so you’d better make sure everything is ready for it!” Moral of the story: If you’re going to change the display settings, make sure you correctly indicate whether you’re doing this temporarily or permanently. The name for the flag CDS_FULLSCREEN acts as a strong hint for telling you when you need to pass it.

Pre-emptive snarky comment: “This blog entry is proof that Microsoft documentation sucks. If the documentation were any good, this article would not have been necessary.” Well, I’m sorry for trying to help. If you prefer, I’ll only write about things that are already well-documented.


Discussion is closed.

Feedback usabilla icon