In this example the driver is queried to see if it supports input, output, or both. 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.
#define INCL_DEV
#include <OS2.H>
HDC hdc;
LONG lStart;
LONG lCount;
BOOL flreturn;
LONG alArray[CAPS_TECHNOLOGY];
lCount = CAPS_TECHNOLOGY;
lStart = CAPS_FAMILY;
flreturn = DevQueryCaps(hdc, /* device context handle */
lStart, /* number of first item */
lCount, /* count of items */
alArray); /* array of longs which */
/* will contain the return */
/* information. */
switch(alArray[CAPS_IO_CAPS]) /* we test the CAPS_IO_CAPS */
/* element of the array to */
/* find out which options */
{ /* are supported. */
case CAPS_IO_SUPPORTS_OP: /* device supports output.*/
break;
case CAPS_IO_SUPPORTS_IP: /* device supports input. */
break;
case CAPS_IO_SUPPORTS_IO: /* device supports both */
/* input and output. */
break;
default:
break;
}