The DrvEnableSurface function sets up a surface to be drawn on and associates it with a given physical device.
HSURF
DrvEnableSurface(
IN DHPDEV dhpdev
);
The return value is a handle that identifies the newly created surface. Otherwise, it is zero, and an error code is logged.
Declared in winddi.h. Include winddi.h.
There are two methods for preparing a surface for use.
For printer devices, the usual situation is for GDI to collect the graphics directly onto a GDI bitmap. The driver should call EngCreateBitmap, which allows GDI to allocate memory for the bitmap.
Any existing GDI bitmap handle is a valid surface handle.
For printer graphics DLLs that use GDI-managed surfaces, the DrvEnableSurface function should call EngCreateBitmap, specifying a surface size large enough to contain an entire physical page. If that fails, repeated calls to EngCreateBitmap should be attempted, with decreasing surface sizes, until a call succeeds. The valid size should be specified as input to EngMarkBandingSurface, which informs GDI that surface banding will be necessary.
After DrvEnableSurface returns a handle to a primary surface, do not call EngModifySurface or EngAssociateSurface on that handle. Doing so can cause a bug check in certain circumstances. For more information, see Microsoft Knowledge Base article 330248.
DrvEnableSurface is required for graphics drivers.
DrvDisableSurface, DrvEnablePDEV, EngCreateBitmap, EngCreateDeviceSurface