LTwain::GetDeviceEventData

Summary

Gets information for a specific device event.

Syntax

#include "ltwrappr.h"

L_INT LTwain::GetDeviceEventData(pDeviceEvent)

Parameters

pTW_DEVICEEVENT pDeviceEvent

Pointer to a TW_DEVICEEVENT structure that references the required device event capability. This structure must be allocated and will be filled with data corresponding to the required capability to get.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

To get the CAP_DEVICEEVENT capability values, call LTwain::GetDeviceEventCapability function.

To set the CAP_DEVICEEVENT capability values, call LTwain::SetDeviceEventCapability function.

To reset the CAP_DEVICEEVENT capability value to the default, call the LTwain::ResetDeviceEventCapability function.

For information about TW_DEVICEEVENT, refer to the TWAIN specification.

Required DLLs and Libraries

See Also

Functions

Topics

Example

float MyFix32ToFloat(TW_FIX32 * ptwFix) 
{ 
   float Floater = 0; 
   Floater = (float)ptwFix->Whole + (float)ptwFix->Frac / (float)65536.0; 
   return Floater; 
} 
 
L_INT LTwain__GetDeviceEventDataExample(LTwain * plTwain) 
{ 
   TW_DEVICEEVENT twDevice; 
   memset(&twDevice, 0, sizeof(TW_DEVICEEVENT)); 
   L_INT nRet = plTwain->GetDeviceEventData(&twDevice); 
   if (nRet != SUCCESS) 
      return nRet; 
 
   L_TCHAR szBuffer[MAX_PATH]; 
   memset(szBuffer, 0, sizeof(szBuffer)); 
   wsprintf(szBuffer, TEXT("Event = %d\nEvent Name  =%s\n"), twDevice.Event, twDevice.DeviceName); 
   MessageBox(NULL, szBuffer, TEXT("Notice!"), MB_OK); 
 
   if (twDevice.Event == TWDE_CHECKBATTERY) 
   { 
      wsprintf(szBuffer, TEXT("Battery Minutes = %d\nBattery Percentage = %d\n"), twDevice.BatteryMinutes, twDevice.BatteryPercentage); 
      MessageBox(NULL, szBuffer, TEXT("Notice!"), MB_OK); 
   } 
   else if (twDevice.Event == TWDE_CHECKPOWERSUPPLY) 
   { 
      wsprintf(szBuffer, TEXT("Power Supply =%d\n"), twDevice.PowerSupply); 
      MessageBox(NULL, szBuffer, TEXT("Notice!"), MB_OK); 
   } 
   else if (twDevice.Event == TWDE_CHECKRESOLUTION) 
   { 
      wsprintf(szBuffer, TEXT("XResolution = %f\nYResolution = %f\n"), MyFix32ToFloat(&twDevice.XResolution), MyFix32ToFloat(&twDevice.YResolution)); 
      MessageBox(NULL, szBuffer, TEXT("Notice!"), MB_OK); 
   } 
   else if (twDevice.Event == TWDE_CHECKFLASH) 
   { 
      wsprintf(szBuffer, TEXT("FlashUsed2 =%d\n"), twDevice.FlashUsed2); 
      MessageBox(NULL, szBuffer, TEXT("Notice!"), MB_OK); 
   } 
   else if (twDevice.Event == TWDE_CHECKAUTOMATICCAPTURE) 
   { 
      wsprintf(szBuffer, TEXT("Automatic Capture =%d\nTime Before First Capture =%d\nTime Between Captures = %d\n"), twDevice.AutomaticCapture, twDevice.TimeBeforeFirstCapture, twDevice.TimeBetweenCaptures); 
      MessageBox(NULL, szBuffer, TEXT("Notice!"), MB_OK); 
   } 
 
   return SUCCESS; 
} 
Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS TWAIN C++ Class Library Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.