LWia::EnumDevices

#include "ltwrappr.h"

virtual L_INT LWia::EnumDevices()

Enumerates all available system WIA devices connected to the user machine.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

This feature is available in LEADTOOLS version 16 or higher.

This function will enumerate 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

LTWIA

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions:

LWia::Acquire, LWia::AcquireToFile, LWia::AcquireSimple, LWia::InitSession, LWia::EndSession, Class Members

Topics:

Managing WIA Sources

 

WIA Functionality: Property Functions

Example

#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_LTWIASAM_CLIB L_INT LWIA__EnumDevicesExample()
{
   L_INT nRet;
   CMyWIA MyClass;
   nRet = MyClass.EnumDevices();
   if (nRet != WIA_SUCCESS)
      return FALSE; 
   return SUCCESS;
}