Before you can send data to a printer using device functions, you must open
a device context with DevOpenDC. The parameters of DevOpenDC are influenced
by the queue and job properties the user has chosen previously.
hab
The anchor-block handle from a WinInitialize
call.
lType
The
type of device context. This always is OD_QUEUED to specify a queued device
context.
pszToken
The
device-information token. Always use an asterisk (*) for this parameter
to force the system to get device information from the pdopData parameter.
lCount
The number
of data elements supplied in the pdopData parameter. The minimum
number of parameters for a queued device context is 4.
pdopData
The device-context data area. This is a pointer
to a structure of the type DEVOPENSTRUC.
The elements of this structure are described below.
hdcComp
The compatible-device-context handle. This
must be NULL for a device context of type OD_QUEUED.
DevOpenDC returns a device-context handle of type HDC.
The handle is used in other functions beginning with the Dev prefix and
for GpiCreatePS and GpiAssociate.
The DEVOPENSTRUC structure contains
all the data needed to define a device context.
The individual elements of the DEVOPENSTRUC structure are described below.
At least the first four structure members must be provided for queued device
contexts.
pszLogAddress
Name of the queue. It is the
pszName field of the PRQINFO3
structure.
Note: For device contexts of type OD_INFO, pszLogAddress is
the port name. This can be retrieved by calling SplQueryDevice using the
pszPrinters device name. The pszLogAddr field in the PRQINFO3
structure is the port name.
pszDriverName
Character string identifying the printer driver,
for example, LASERJET. The pszDriverName field of the PRQINFO3
structure, associated with the required print queue, gives the driver
and device name, separated by a period, for example LASERJET.HP LaserJet
IIID The pszDriverName field can contain only the name up to the
period, for example LASERJET.
pdriv
This
is a pointer to the job properties data returned by the printer driver from
DevPostDeviceModes or the default job properties from pDriverData in
the PRQINFO3 structure.
Note: The DRIVDATA structure
contains the particular device name to be used. Therefore, it is a programming
error to set this parameter to NULL.
pszDataType
It is recommended that PM_Q_STD always be used
for the data type.
pszComment
pszQueueProcName
Queue processor name (optional). The queue
processor (also termed queue driver) name is available from the pszPrProc
field of the PRQINFO3 structure.
The default queue processor provided by the operating system is PMPRINT.
The user also can install a queue processor (PMPLOT) that is used to provide
reverse clipping for vector devices such as plotters.
For specialized applications, it is possible to use an alternative queue
processor to the default specified for the queue. The list of installed
queue processors is available from the OS2SYS.INI file using the application
name PM_SPOOLER_QP.
pszQueueProcParams
Queue
processor parameters (optional). They can include information such as the
number of copies you want to print and the size of the output area on the
printed page. See PMPRINT/PMPLOT
Queue Processor Parameters for details.
pszSpoolerParams
Spooler parameters (optional) are separated
by spaces. They are used for scheduling print jobs and are as follows:
- The form names that identify the paper to be used,
for example, FORM=A4,A5,ENV. The form names are optional, but if
they are provided, the spooler is able to hold
off printing the jobs until the required form is installed in the printer.
If the form name is not provided, the spooler attempts to print the job.
The printer driver recognizes that there is a forms problem and displays
a FORMS MISMATCH message box.
- Priority of the print job, for example, PRTY=60.
The priority is specified as an integer in the range 1 through 99; 99 is
the highest. The default priority value is 50. The application can use the
spooler priority parameter to prioritize its own jobs. However, it is not
good practice for an application always to use priority 99 in an attempt
to get its jobs printed first.
pszNetworkParams
Optional parameter that can be used to specify
network options; for example, USER=JOESMITH.
[Back: Creating a New Thread]
[Next: Associating a Presentation Space]