Ref: "Ap1400ProgGuide1_2.docx"
Page 29 of 42
Document Revision: “1.2”
Document Date: “9 Apr. 2013”
EnumPrinters
Enumerates all the available USB printers with an ABLE vendor ID
Prototype
int
WINAPI EnumPrinters(
void
);
Description
Enumerates all available printers present on the USB with a valid ‘Able Systems’
vendor ID. All control structures for each device found, are built and initialised from
the printer supplied control information blocks.
This function must be called prior to accessing an individual, or group of printers.
If the function is called more than once, then each call should be preceded with a
call to ClearEnumList.
Arguments
None
Returns
Integer value representing the number of printers successfully enumerated.
If an error occurs then the number returned will be 0 and the system error code will
be set. If the return indicates 0 printers and the system error code is
ERROR_SUCCESS, then no error has occurred, there are just no printers
available.
The system error code can be retrieved by calling GetLastError()
Example
//Clear existing list
ClearEnumList();
//Enumerate
int
m_iEnumeratedPrinters=EnumPrinters();
//Display results
if(GetLastError()==ERROR_SUCCESS)
TRACE(_T(“Success–Printer count=%d.\n”),m_iEnumeratedPrinters);
else
TRACE(_T(“FAILED-Return code=%d.\n”),GetLastError());