Available in LEADTOOLS Imaging Pro, Vector, Document, and Medical Imaging toolkits. |
LTwain::GetDeviceEventData
#include "ltwrappr.h"
L_INT LTwain::GetDeviceEventData(pDeviceEvent)
pTW_DEVICEEVENT pDeviceEvent; |
/* pointer to a structure */ |
Gets information for a specific device event.
Parameter |
Description |
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
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 rest the CAP_DEVICEEVENT capability value to the default, call LTwain::ResetDeviceEventCapability function.
For information about TW_DEVICEEVENT, refer to the TWAIN 1.9 specification from the site http://www.twain.org/.
Required DLLs and Libraries
LTTWN 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: |
LTwain::SetDeviceEventCapability, LTwain::GetDeviceEventCapability, LTwain::ResetDeviceEventCapability |
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; }