PDA

View Full Version : A naive question about full-screen mode



galaxy3001
03-07-2003, 11:45 AM
I have a rather naive question about setting up a full-screen mode. What one usually does is to change a few fields in a DEVMODE structure, and apply this structure using the ChangeDisplaySettings function. But before changing any field, one clears the DEVMODE structure using a memset function which zeros all the fields. So at the time one applies the DEVMODE, every field that hasn't been assigned a value equals zero. How could this be correct? DEVMODE contains fields like dmDeviceName, dmDriverVersion, etc, for which a zero value doesn't look reasonable.

Bob
03-07-2003, 12:20 PM
You use dmFields to indicate which values are used.

galaxy3001
03-07-2003, 12:35 PM
Thanks a lot for help.

Does it mean that except for the values indicated in dmFields, system default will be used?

What about the dmSize field, it is also set, but not mentioned in dmFields, is it a convention that dmSize will always be updated?

And also, if dmFields is used to indicate what fields are changed, then why do we use the memset function to clear fields at the beginning? Why can't we just setup whatever fields we need and indicate them in dmFields? I mean if only those fields indicated by dmFields get picked up, then why do we care to clear bits?


[This message has been edited by galaxy3001 (edited 03-07-2003).]

Bob
03-07-2003, 01:04 PM
For values not used, some kind of default is used. Not sure, but this default may be different between different versions of Windows, or even different hardware.

dmSize is used to indicate which version of DEVMODE you use. Newer versions has more fields, which results in a bigger structure. This field must be set in order to identity correct version, and therefore does not have to be set in dmFields.

I doubt you really have to clear the structure in order to use it, but it's always good not to leave anything uninitialized.

galaxy3001
03-07-2003, 01:09 PM
Great helps, Bob.
Thanks a lot!