Primary Display Drivers (Windows CE 5.0)

Send Feedback

If your hardware 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 run-time image includes 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 run-time image 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:

  1. 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 This function passes an array of function pointers to GWES.exe. It also must copy the GWES support functions so 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.

  2. 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, as explained in the following table.

    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.

    A wide range of attribute-setting functions is available.

    None of these result 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.

  3. After you complete 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 Run-Time Image

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.