Primary Display Drivers
If your platform includes a display, Windows CE loads the default, or primary, display driver when the system boots. By default, GWES loads a display driver named Ddi.dll. If the optional HKEY_LOCAL_MACHINE\System\GDI\Drivers\Display registry key is present, GWES loads the display driver that is indicated by that registry key. If the platform is configured to include windowing functionality, the Window Manager uses the frame buffer that is supported by the primary display driver for all on-screen drawing.
To perform a drawing operation, an application must first obtain a device context for a window or the desktop by calling CreateWindow and GetDC. The resulting device context is the application's drawing surface. If the application's platform does not include support for windowing, and, as a result, has no Window Manager, the application must call CreateDC with the name of the primary display driver's DLL file to create a device context directly.
The following sequence of steps shows the process of connecting and disconnecting from devices:
The CreateDC function provides the only way that GDI enables an application to create a connection to a graphic device. It also calls the driver's initialization functions. The device context returned from calls, such as BeginPaint and GetDC have been created by the Window Manager by calling CreateDC.
The following table shows the driver's initialization functions.
Function Description DrvEnableDriver The role of this function is to pass an array of function pointers to GWES.exe. It also must copy the GWES support functions so that the driver can get the basic set of support services provided by GWES to graphic drivers. This function is called just once when the driver is first loaded. DrvEnablePDEV This function is called each time a device context is created. There is a one-to-one mapping between API calls to CreateDC and GWES calls to DrvEnablePDEV. After an application connects to a display driver and the calls to the driver's initialization function are complete, you can query, set attributes, and draw. The following table describes these three tasks.
Task Description Querying The most important task that an application performs is querying. For example, the application must determine the following items: - The size of the drawing area before it draws.
- What fonts are available before it draws text.
- The color support before it draws a photograph.
Much of this information comes from the graphic driver.
GetDeviceCaps is an important query function. It allows an application to view the GDIINFO structure, a structure returned by the graphics driver to GDI during device context initialization. The driver returns this structure when the DrvEnablePDEV function is called.
Setting attributes Applications set attributes, which involves deciding which font to use when drawing text, and which color to use to draw the text. There is a wide range of attribute-setting functions available. None of these results in calls to the driver; instead, GWES sends the key attribute values to the driver during the drawing calls. Drawing Each API-level drawing function results in a call to a driver-level function. Mapping the API-to-DDI function calls can help ensure you understand the purpose of each driver-level function. In this example, calls to the Polyline function become calls to DrvStrokePath within the driver. When you have completed querying, setting attributes, and drawing, you can disconnect the application from the device. The following table shows the functions necessary for an application to disconnect from a device.
Function Description DeleteDC This API-level function is the counterpart to CreateDC. DrvDisablePDEV This DDI-level function is the counterpart to DrvEnablePDEV.
See Also
Display Drivers | Display Driver Extensions | Display Driver Samples | Secondary Display Drivers | DDI Functions | BitBlT Emulation Library Functions | GPE Base Classes | GDI Support Services | Display Buffer Formats | Line Drawing | Display Driver Escape Codes | Display Drivers and the OS Image
Last updated on Tuesday, May 18, 2004
© 1992-2003 Microsoft Corporation. All rights reserved.