Microsoft Windows CE 3.0  

Deriving from DDGPE

This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

There are several minor changes and additions you can make to your DDGPE-based driver that will add greater functionality and power to your implementation. These changes include functions you should override, member variables you should set, and functions you should call. Each of these items is covered under its own topic.

Functions You Should Override

This section describes the DDGPEclass functions your DDGPE-based display driver should override and implement in order to improve its DDGPEsupport.


The AllocSurfacefunction allows the EDDGPEPixelFormatdata type to be integrated into your driver. With the addition of this data type, your driver can begin to support a wide variety of surface types.

virtual SCODE AllocSurface ( DDGPESurf **ppSurf,
int width, int height, EGPEFormat format, EDDGPEPixelFormat
pixelFormat, int surfaceFlags );


The GetModeInfoExfunction provides DDGPEwith extended pixel format information that applies to a specific mode. This is useful to both DDGPEclasses and the DDGPEDDHAL implementation.

To override this function, you need to store detailed information about the different modes that are supported by your driver.

virtual SCODE GetModeInfoEx ( GPEModeEx *pModeEx,
int modeNo );


The SetModefunction is a standard function that must be implemented by any GPE-based driver. This function has been overloaded in DDGPEwith a new version that supports an extra flag. This flag, bChangeGDISurfaceMode, allows the caller to indicate whether the GDI primary surface should be modified or if just the physical hardware mode needs to be changed. This difference is important in situations where DDGPEor DirectDraw require that the GDI surface be separated from the surface that is actually being displayed on the screen.

The SetModefunction should behave as usual if the bChangeGDISurfaceMode flag is set to TRUE. Otherwise, it should simply change the hardware mode and update any corresponding flags. (For example, it should update the m_dwPhysicalModeID flag, which is also described in this section.)

virtual SCODE SetMode ( int modeNo, HPALETTE
*pPalette, BOOL bChangeGDISurfaceMode );


The SetVisibleSurfacefunction has been added by DDGPE. By default, the DDGPEimplementation of this function does nothing. However, to support DirectDraw surface Flips, you should implement this function. It should change the display to show the selected surface. The current GDI primary surface should not be changed.

virtual void SetVisibleSurface ( GPESurf *pSurf,
BOOL bWaitForVBlank = FALSE );

Member Variables You Should Set

This section points out some of DDGPE's member variables and indicates when and why they should be updated.


This member variable should always point to the extended mode information for GDI's current display mode. You should update it at initialization time, and whenever the GDI primary surface's mode is changed. As a rule of thumb, the m_pModeEx member variable should be updated whenever the GPEmember variable m_pMode is updated. Note that because of the structure of GPEModeEx, m_pModeEx and m_pMode can point to the same block of memory.

To support this member variable, you will need to store extended information for all modes supported by your driver.

GPEModeEx m_pModeEx;


The m_dwPhysicalModeID member variable indicates the index of the mode that is actually being displayed on the screen. This does not necessarily correspond to the current mode of the GDI primary surface.

This value should be updated whenever the hardware's display mode changes, regardless of whether or not the pixel format of the GDI primary surface has changed.

DWORD m_dwPhysicalModeID;

Functions You Should Call


You should call the SetDriverGUIDfunction to supply the DDGPEobject with a unique way to identify your driver from other drivers. DDGPESurfobjects that your driver creates should also be tagged with this GUID.

virtual void SetDriverGUID ( GUID guidDriverGUID

 Last updated on Tuesday, July 13, 2004

© 2004 Microsoft Corporation. All rights reserved.