Ref: "Ap1400ProgGuide1_2.docx"
Page 33 of 42
Document Revision: “1.2”
Document Date: “9 Apr. 2013”
GetProduct
Gets the product ID of an enumerated device
Prototype
DWORD
WINAPI GetProduct(
int
iIndex);
Description
Retrieves the product id of the device as a doubleword value. product Id’s are
specific to usb device manufacture’s individual products and can be used in the
identification of a device.
A call to EnumPrinters must have been made prior to calling this function
Arguments
iIndex – The index of the device. This must be an integer value
>=0<GetEnumPrinterCount();
If this value is outside of this range then an exception will be thrown.
Returns
DWORD representing the product id. The system error code will be set to
ERROR_SUCCESS regardless of whether the product id is valid or not.
Example
//Check range prior to call
if(
iDevIndex>=0&&iDevIndex< GetEnumPrinterCount)
{
DWORD
dwProductID=GetProduct(iDevIndex);
//Display results
TRACE(_T(“Product ID for device index %d is %04X.\n”),
iDevIndex,dwProductID);
}