Enumerating ModesTo be able to enumerate the Display Modes, a valid DirectDraw object must already be created with DirectDrawCreateEx(). As you should know, the DirectDrawCreateEx() function takes the GUID of a Display Driver as it's first argument. If this GUID value is NULL, the primary Display Driver is assumed to be the Driver being created. Since the Display Mode and Devices are dependant on the Display Driver created, this is done for each Display Driver enumerated.
The call to enumerate Display Modes is EnumDisplayModes(). The paramters passed are: the flags, a DDSURFACEDESC2 value to check against, the pointer to any variable you wish to pass, and lastly, the pointer to the callback function For Example:
EnumDisplayModes will be called once for each Display Mode found. Notice that I passed the address of the current DisplayDriver's DisplayModeList variable. The code for EnumDisplayModes follows In EnumDisplayModes, a variable is declared to refer to the DisplayModeList value passed. A new DisplayMode variable is then allocated. This structure is filled with the relevant information that was passed to this function. This information includes the Width, Height and Depth of the Mode Enumerated. Next, the Mode is added to the end of the DisplayModeList passed.
|
|||||||||||