GetDeviceEventData方法

总结
获取特定设备事件的信息。
语法
c#
VB
c++
公共TwainDeviceEventGetDeviceEventData ()
公共函数GetDeviceEventData ()作为TwainDeviceEvent
公共TwainDeviceEvent ^GetDeviceEventData ();

返回值

代表设备事件信息的TwainDeviceEvent对象

讲话

此方法将返回特定设备事件的信息。要获取每个设备事件的状态,请将EnableGetDeviceEvent属性设置为TRUE以启用触发GetDeviceEvent事件要获取CAP_DEVICEEVENT能力值,请调用GetDeviceEventCapability方法,要设置CAP_DEVICEEVENT能力,请调用SetDeviceEventCapability方法,也可以调用ResetDeviceEventCapability方法来重置CAP_DEVICEEVENT能力

该方法应该在GetDeviceEvent事件中调用,以获取设备事件信息。

例子
c#
VB
使用Leadtools;使用Leadtools.Twain;TwainSession session =TwainSession ();公共无效GetDeviceEventDataExample (IntPtr父)试一试会话。启动(父,“制造商”,“productFamily”,“版本”,“应用程序”, TwainStartupFlags.None);会话。GetDeviceEvent + =EventHandler < EventArgs > (session_GetDeviceEvent);会话。EnableGetDeviceEvent =真正的session.Acquire (TwainUserInterfaceFlags.Show);session.Shutdown ();}{}}无效session_GetDeviceEvent (对象发送者,EventArgs试一试TwainDeviceEvent deviceEvent = session.GetDeviceEventData();字符串味精=字符串.Format ("事件={0}\nEvent Name ={1}\n", deviceEvent。事件,deviceEvent。DeviceName);MessageBox.Show(味精);如果(deviceEvent。事件== TwainCapabilityValue。DeviceEventCheckBattery)味精=字符串.Format (“电池时间={0}\n电池百分比={1}\n”, deviceEvent。BatteryMinutes deviceEvent.BatteryPercentage);MessageBox.Show(味精);}其他的如果(deviceEvent。事件== TwainCapabilityValue。DeviceEventCheckPowerSupply)味精=字符串.Format (“电源={0}\n”, deviceEvent.PowerSupply);MessageBox.Show(味精);}其他的如果(deviceEvent。事件== TwainCapabilityValue。DeviceEventCheckPowerSupply)味精=字符串.Format ("XResolution ={0}\nYResolution ={1}\n", deviceEvent。XResolution deviceEvent.YResolution);MessageBox.Show(味精);}其他的如果(deviceEvent。事件== TwainCapabilityValue。DeviceEventCheckFlash)味精=字符串.Format (“FlashUsed2 = {0} \ n”, deviceEvent.FlashUsed2);MessageBox.Show(味精);}其他的如果(deviceEvent。事件== TwainCapabilityValue。DeviceEventCheckAutomaticCapture)味精=字符串.Format (“自动捕获={0}\nTime第一次捕获之前={1}\nTime捕获之间={2}\n”, deviceEvent。AutomaticCapture deviceEvent。TimeBeforeFirstCapture deviceEvent.TimeBetweenCaptures);MessageBox.Show(味精);}}{}}
进口Leadtools进口Leadtools。吐温公共感到失望会话作为TwainSession =TwainSession ()私人session_GetDeviceEvent (按值传递发送方作为对象,按值传递e作为System.EventArgs)处理会话。GetDeviceEvent试一试昏暗的deviceEvent作为TwainDeviceEvent = session.GetDeviceEventData()昏暗的味精作为字符串字符串.Format ("事件={0}{1}事件名称={2}", deviceEvent。事件, Chr(13), deviceEvent.DeviceName)MessageBox.Show(味精)如果deviceEvent。事件= TwainCapabilityValue。DeviceEventCheckBattery然后味精=字符串.Format (“电池时间={0}{1}电池百分比={2}”, deviceEvent。电池分钟,Chr(13), deviceEvent.BatteryPercentage)MessageBox.Show(味精)ElseIfdeviceEvent。事件= TwainCapabilityValue。DeviceEventCheckPowerSupply然后味精=字符串.Format (“电源={0}”deviceEvent.PowerSupply)MessageBox.Show(味精)ElseIfdeviceEvent。事件= TwainCapabilityValue。DeviceEventCheckPowerSupply然后味精=字符串.Format ("XResolution ={0}{1}YResolution ={2}", deviceEvent。XResolution, Chr(13), deviceEvent.YResolution)MessageBox.Show(味精)ElseIfdeviceEvent。事件= TwainCapabilityValue。DeviceEventCheckFlash然后味精=字符串.Format (“FlashUsed2 ={0}”deviceEvent.FlashUsed2)MessageBox.Show(味精)ElseIfdeviceEvent。事件= TwainCapabilityValue。DeviceEventCheckAutomaticCapture然后味精=字符串.Format (“自动捕获={0}{1}第一次捕获前时间={2}{3}捕获间隔时间={4}”, deviceEvent。自动捕获,Chr(13), deviceEvent。TimeBeforeFirstCapture, Chr(13), deviceEvent.TimeBetweenCaptures)MessageBox.Show(味精)结束如果结束试一试结束公共GetDeviceEventDataExample (按值传递作为IntPtr)试一试会话。启动(父,“制造商”,“productFamily”,“版本”,“应用程序”TwainStartupFlags.None)AddHandler会话。GetDeviceEvent,AddressOfsession_GetDeviceEvent会话。EnableGetDeviceEvent =真正的session.Acquire (TwainUserInterfaceFlags.Show)session.Shutdown ()结束试一试结束
需求

目标平台

Leadtools。吐温作为sembly
188金宝搏的网址客服|支持|联系我们|知识产权公告
©1991 - 2021领德科技有限公司版权所有。