User manual

CLEARjet GmbH CX-one
1.4.2 Sample Program
Use this or a similar program to proceed after printing (if the Windows driver was
used).
The following steps must be executed for requesting the printer status:
1. Create a handle of the printer with the function "OpenPrinter".
2. Check existing print jobs for the CLEARjet printer with the function
"EnumJobs"
3. This function returns the count of existing print jobs in the queue.
4. If the return value is "0" execution of printer commands (e.g. status requests)
is allowed.
Sample code:
============
HANDLE hPrinter;
// Open printer
if (OpenPrinter ("CX-one", &hPrinter, NULL))
{
while (true)
{
DWORD dwNeeded = 0;
DWORD dwReturned = 0;
// is there a printjob in the queue
if (EnumJobs (hPrinter, 0, 1, 1, NULL, 0, &dwNeeded,
&dwReturned))
{
// one or more jobs
if (dwNeeded == 0)
break;
else
Sleep (200);
}
}
// close printer
ClosePrinter (hPrinter);
// wait for data send via usb
Sleep (200);
}
*************************************************************
Programmers Manual Page 9 / 53