Platform SDK: DirectX

Step 1: Set the Cooperative Level and the Display Mode

[C++]

This section pertains only to application development in Visual Basic. See DirectDraw C/C++ Tutorials.

[Visual Basic]

The first step in creating a full-screen application in DirectDraw is to set the cooperative level and the display mode for the DirectDraw object. Setting the cooperative level determines the top-level behavior of the application. We want this application to have exclusive access to the primary display and run in the full screen. Note: to run in full-screen mode you must also have exclusive access. Additionally, we want the enable the Mode X which is derived from the standard VGA Mode 13. The cooperative level is set through the following calls:

Set dd = dx.DirectDrawCreate("")
Me.Show
Call dd.SetCooperativeLevel(Me.hWnd, DDSCL_FULLSCREEN Or DDSCL_ALLOWMODEX Or DDSCL_EXCLUSIVE)

After setting the cooperative level, we must set the display mode for this application by calling the DirectDraw7.SetDisplayMode method:

dd.SetDisplayMode 640, 480, 16, 0, DDSDM_DEFAULT

The first two parameters are the height and width of the mode. The third is the bits per pixel (bpp). Next is the refresh rate, specifying 0 requests the default refresh rate for the driver. The last parameter is additional options, DDSDM_DEFAULT sets the mode without substituting Mode 13 for Mode X.

Next: Step 2: Create a Complex Surface