DHPDEV DrvEnablePDEV(
IN DEVMODEW *pdm, | |
IN LPWSTR pwszLogAddress, | |
IN ULONG cPat, | |
OUT HSURF *phsurfPatterns, | |
IN ULONG cjCaps, | |
OUT ULONG *pdevcaps, | |
IN ULONG cjDevInfo, | |
OUT DEVINFO *pdi, | |
IN HDEV hdev, | |
IN LPWSTR pwszDeviceName, | |
IN HANDLE hDriver | |
); |
DrvEnablePDEV creates a logical representation of a physical device upon which the driver can associate a drawing surface.
Pattern |
Description |
HS_HORIZONTAL |
Horizontal hatch. |
HS_VERTICAL |
Vertical hatch. |
HS_FDIAGONAL |
45-degree upward hatch (left to right). |
HS_BDIAGONAL |
45-degree downward hatch (left to right). |
HS_CROSS |
Horizontal and vertical cross hatch. |
HS_DIAGCROSS |
45-degree crosshatch. |
Note The number of default hatch patterns that require driver support was reduced in a previous version of the DDK. Consequently, HS_DDI_MAX, typically used by drivers to declare the size of the pattern array, was reduced.
GDI calls DrvRealizeBrush with one of these surfaces to realize a brush with a standard pattern.
Each of these surfaces must be a monochrome (1 bit per pixel) GDI bitmap for raster devices. The device driver should choose patterns that will look most like standard patterns when written on the device surface.
GDI is never required to use these brushes in support routines for a vector
device. Therefore, surfaces can be device-supported surfaces that DrvRealizeBrush
recognizes as standard patterns.
The return value is a handle to the PDEV that identifies the enabled device if the function is successful. Otherwise, it is zero, and an error code is logged.
The device driver represents a logical device, called a PDEV. The PDEV is managed by GDI. A single logical device can manage several PDEVs that can be differentiated by the following:
Each call to DrvEnablePDEV creates another device that is used with a distinct surface. The DEVMODEW structure indicates the type of hardware requested. GDI manages the logical address for printers and other hard copy output devices. The spooler service WritePrinter (a Win32 function) directs output to the proper destination. Displays and input devices either know their logical address implicitly or get it from the private section of the DEVMODEW structure. For more information, see the Win32 SDK.
When receiving a call to this function, the driver must allocate the memory to support the PDEV. However, the actual surface need not be supported until GDI calls DrvEnableSurface.
If a device surface requires a bitmap to be allocated, these allocations need not be made until needed. Although applications often request device information long before actually writing to the device, waiting to allocate resources, such as large bitmaps, can conserve memory.
GDI zero-initializes the buffer pointed to by phsurfPatterns before calling this function.
DrvEnablePDEV is required for graphics drivers.
DEVINFO, DEVMODEW, DrvEnableSurface, DrvRealizeBrush, EngCreatePalette, GDIINFO