DevQueryHardcopyCaps - Example Code

The height and width of the capability of the output device is queried for each form code available. Note that a valid device context handle must be passed. This example assumes a DevOpenDC call has been made to obtain the device context handle of a say a printer.

#define INCL_DEV
#include <OS2.H>

HDC hdc;
LONG lStartForm;      /* Form code number from which the query */
                      /* is to start                           */
LONG lForms;          /* number of forms to query              */
/* array of structures containing return information. */
HCINFO ahciHcInfo[5];
LONG lreturn;
int i;
HCINFO height[5];
HCINFO width[5];

lStartForm = 0L;
lForms = 0L;           /* the actual number of forms codes is */
                       /* returned. There will be lreturn      */
                       /* copies of the HINFO structure.       */

lreturn = DevQueryHardcopyCaps(hdc,
                               lStartForm,
                               lForms,
                               ahciHcInfo);
if (lreturn > 5)
{
 lreturn = 5L;        /* we only want the first five form codes */
}                     /* if there are more than five            */

for(i = 0; i < lreturn; i++)
{
 width[lreturn].cx = ahciHcInfo[lreturn].cx;
 height[lreturn].cy = ahciHcInfo[lreturn].cy;
}


[Back: DevQueryHardcopyCaps - Related Functions]
[Next: DevQueryHardcopyCaps - Topics]