Platform SDK: DirectX

ModeTest Sample

[Visual Basic]

This topic pertains only to application development in C and C++. See DirectDraw Visual Basic Samples.

[C++]

Description

This example demonstrates basic usage of the IDirectDraw7::StartModeTest and IDirectDraw7::EvaluateMode methods. Together, these methods allow an application to explore what display modes and refresh rates the monitor connected to the display device is able to display Applications can use these methods when they are interested in using higher refresh rates.

Path

Source: (SDK root)\Samples\Multimedia\DDraw\Src\ModeTest

Executable: (SDK root)\Samples\Multimedia\DDraw\Bin\ModeTest.exe

User's Guide

The user interface is a simple dialog box. First select the DirectDraw display device. Then select one or more modes from the left-hand list box and click Test. Each display mode is tested, and you can specify whether the mode appears correctly or note. If you make a mistake, click Reset and try again. Click Close to exit the application.

Programming Notes

DirectDraw sets up a list of modes to be tested, based on the list the application passed in, and then sequentially tests them under application control.

The application calls IDirectDraw7::EvaluateMode continuously. DirectDraw takes care of setting the modes. All the application has to do is set the cooperative level beforehand, and then handle surface loss and drawing the interface that asks the user if the current mode is displaying correctly. DirectDraw returns enough information from EvalulateMode to allow the application to know when to do these things, and when to stop testing.

The application can pass a flag to EvaluateMode if the user approves the mode, which will cause DirectDraw to mark the mode as good and move on. DirectDraw may also decide that time has run out and give up on a certain mode.

DirectDraw uses information at its disposal from any automated means to make the testing process as short as possible, and applications only need to test modes they are interested in.