Full Screen Question

Is full screen is just a window with WS_POPUP style and position at (0, 0) with the width of screen and height of screen?

On most hardware that is what it would be in Windows. I hesitate to even mention the exceptions but I will if only for the sake of trivia. On old Voodoo cards, you always got a fullscreen regardless of how big the window was, since they were secondary video cards.

Then what’s the use of

ChangeDisplaySetting(&dmSetting, CDS_FULLSCREEN);

the CDS_FULLSCREEN flag is used to remove the taskbar (otherwise it would be displayed over your ‘fullscreen’ window)

ChangeDisplaySettings is used to change the display settings (no joke ). It’s a pretty important part, because if you have a default desktop resolution of 1280x1024, but want to run fullscreen in 640x480, you have to change the display settings. Otherwise, the resolution will remain 1280x1024.

CDS_FULLSCREEN tells Windows that the mode you set is a temporary mode, and is not supposed to be written in the registry. This means that if you don’t restore the resolution, it will be back to the original next time you restart Windows. I think this is also the reason why you can call ChangeDisplaySettings(NULL, 0) to restore resolution when your program exits.
If you use CDS_GLOBAL or CDS_UPDATEREGISTRY, you permanently change the display settings. CDS_FULLSCREEN has nothing to do with creating a fullscreen window.

I believe that Tron is right regarding the taskbar. Otherwise CDS_FULLSCREEN would be useless : passing 0 would do the job (MSDN quote : “0 | The graphics mode for the current screen will be changed dynamically”. That’s what we want, isn’t it?). What is the difference code-wise between “I want to resize my desktop with the taskbar” and "I want to resize my desktop without the taskbar (ie go in fullscreen mode as we usually say)? It might be the CDS_FULLSCREEN flag.

Anyway, as usual, Win32 API documentation is not clear.

I agree with you Bob on the registry part.

I agree with you Bob on the registry part.

What, you don’t agree on CDS_FULLSCREEN being a temporary change of the display settings?

If you want to go back to the original settings, it’s best for you you didn’t make a permanent change

What’s the difference between a “temporary” change, and a “permanent” change?? Simply the registry update.

So if you don’t specify CDS_UPDATEREGISTRY, the change will be temporary, ie you will be able to go back to the original settings with the usual code lide

ChangeDisplaySettings(NULL, 0);

The code below works on my Win2000 system :

#include <windows.h>

void main()
	dev.dmSize = sizeof(DEVMODE);
	dev.dmBitsPerPel = 32;
	dev.dmPelsWidth = 1024;
	dev.dmPelsHeight = 768;
	dev.dmDisplayFrequency = 75;

	ChangeDisplaySettings(& dev, 0 /*CDS_FULLSCREEN*/);


	ChangeDisplaySettings(NULL, 0);

However, there is a difference between the two (with or without CDS_FULLSCREEN) : if I have a maximized window, it is resized when using 0, and not resized when using CDS_FULLSCREEN. This explains what they call “a temporary change”. So according to M$ vocabulary, my first statement is false (registry update is not the only difference). But you can still go back to the original settings if you don’t set the CDS_UPDATEREGISTRY flag (eg using 0).

Note : when using 0, the maximized window is resized, letting room at the bottom for the taskbar, but the taskbar doesn’t show…

Have another question.
By using CDS_FULLSCREEN, can I increase the frame rate?

Short answer : no.

It is a common mistake to think that an app will run faster in fullscreen mode than in windowed mode. Maybe it’s because on old 3D accelerators you could only get hardware acceleration in fullscreen mode. But these times are over

Bottom line : your app won’t run faster in 640480 fullscreen mode than in a 640480 window.

That’s not a given kehziah. For double buffered applications, some drivers do page flipping in fullscreen and block transfers in windowed mode. There could be a significant difference in performance in this case.

You’re right. I was giving a short (inaccurate) answer. Also, using a different color format from the desktop format would probably slow down the app because of conversion. Setting fullscreen mode with apropriate pixelformat would help.

[This message has been edited by kehziah (edited 12-08-2001).]

Thank you guys very much!

Also your framerate will not go above your screen refresh rate. So if, like me, your screen refresh is limited to 60 Hz at 1600x1200, then your 640x480 window will not go above 60 fps, while in fullscreen it may go to 160 fps or whatever.

Originally posted by Keermalec:
Also your framerate will not go above your screen refresh rate. So if, like me, your screen refresh is limited to 60 Hz at 1600x1200, then your 640x480 window will not go above 60 fps, while in fullscreen it may go to 160 fps or whatever.

I think it depends only on when you have the v-sync on and off. If it is on in fullscreen mode, the framerate will no go above the refresh rate. And when it is off in windowed mode, framerate can go much higher.