#include "ltwrappr.h"
virtual L_INT LWia::EnumDevices()
Enumerates all available system WIA devices connected to the user machine.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
This feature is available in LEADTOOLS version 16 or higher.
This function enumerates all available system WIA devices connected to the user machine. It uses a callback that sends the user information about each WIA device found, like device ID, device name, and device description.
Required DLLs and Libraries
Platforms
LEADTOOLS WIA supports both 32-bit and 64-bit image acquisition for both WIA 1.0 (XP and earlier) and WIA 2.0 (VISTA and later).
#include <Sti.h>
class CMyWIA : public LWia
{
public:
L_INT EnumDevicesCallBack(pLWIADEVICEID pDeviceID);
};
L_INT CMyWIA::EnumDevicesCallBack(pLWIADEVICEID pDeviceID)
{
L_INT nRet;
L_UINT uDevType;
L_TCHAR szSelectedDeviceID[MAX_PATH] = TEXT("");
L_TCHAR szMsg[MAX_PATH] = TEXT("");
/* Select the received device */
if(pDeviceID)
{
if(pDeviceID->pszDeviceId)
{
//nRet = SelectDevice(pDeviceID->pszDeviceId);
}
}
/* Get the selected device type */
nRet = GetSelectedDeviceType(&uDevType);
if(nRet != WIA_SUCCESS)
return nRet;
if(uDevType == WiaDeviceTypeScanner)
{
/* Make sure the device was selected successfully */
lstrcpy(szSelectedDeviceID, GetSelectedDevice());
wsprintf(szMsg, TEXT("Scanner device with the device ID <%s> selected."), szSelectedDeviceID);
MessageBox(NULL, szMsg, TEXT("Information"), MB_OK|MB_ICONINFORMATION);
}
return WIA_SUCCESS;
}
L_INT LWIA__EnumDevicesExample()
{
L_INT nRet;
CMyWIA MyClass;
nRet = MyClass.EnumDevices();
if (nRet != WIA_SUCCESS)
return FALSE;
return SUCCESS;
}