Prev Next

GetPrinterDriver info  Overview  Group

The GetPrinterDriver function retrieves driver data for the specified printer.

BOOL GetPrinterDriver(

    HANDLE hPrinter,

// printer object

    LPTSTR pEnvironment,

// address of environment

    DWORD Level,

// structure level

    LPBYTE pDriverInfo,

// address of structure array

    DWORD cbBuf,

// size, in bytes, of array

    LPDWORD pcbNeeded 

// address of variable with number of bytes retrieved (or required)

   );

Parameters

hPrinter
Identifies the printer for which the driver data should be retrieved.
pEnvironment
Points to a null-terminated string that specifies the environment. For example, “Windows NT x86” specifies Windows NT running on an Intel 80386 or 80486 processor. If this parameter is NULL, the current environment of the calling application and client machine (not of the destination application and print server) is used.
Level
Specifies the version of the structure to which lpbForm points. This value must be either 1, 2., or 3.
pDriverInfo
Points to either a DRIVER_INFO_1, DRIVER_INFO_2, or DRIVER_INFO_3structure. If Level is 1, this array receives a DRIVER_INFO_1 structure; if Level is 2, this array receives a DRIVER_INFO_2 structure, if Level is 3, this array receives a DRIVER_INFO_3 structure.
cbBuf
Specifies the size, in bytes, of the array at which pDriverInfo points.
pcbNeeded
Points to a value that specifies the number of bytes copied if the function succeeds or the number of bytes required if cbBuf is too small.

Return Values

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

The printer handle identified by the hPrinter parameter should be retrieved by calling the OpenPrinter function.

The DRIVER_INFO_2 and DRIVER_INFO_3 structures contain a full path and filename specifying the location of the printer driver. An application can use the path and filename to load a printer driver by calling the LoadLibrary function and supplying the path and filename as the single argument.

See Also

AddPrinterDriver, DRIVER_INFO_1, DRIVER_INFO_2, EnumPrinterDrivers, LoadLibrary, OpenPrinter