TwainDeviceEvent Class |
Namespace: Atalasoft.Twain
The TwainDeviceEvent type exposes the following members.
| Name | Description | |
|---|---|---|
| TwainDeviceEvent | Creates a new instance of TwainDeviceEvent. |
| Name | Description | |
|---|---|---|
| AutomaticCapture | Number of images camera will capture. | |
| BatteryMinutes | Minutes of battery power remaining. | |
| BatteryPercentage | Percentage of battery power remaining. | |
| Event | The event that was raised. | |
| FlashUsed2 | Current flash setting. | |
| Name | The name of the device. | |
| PowerSupply | Current power supply in use. | |
| TimeBeforeFirstCapture | Number of seconds before first capture. | |
| TimeBetweenCaptures | Hundredths of a second between captures. | |
| XResolution | Current X Resolution. | |
| YResolution | Current Y Resolution. |
| Name | Description | |
|---|---|---|
| Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
| Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
| GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
| GetStructurePointer | Creates the memory pointer containing data sent to Twain. | |
| GetType | Gets the Type of the current instance. (Inherited from Object.) | |
| IsSupportedCommand | Returns a value indicating whether the implementing class supports a specific TwainTriplet
command. | |
| MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
| ProcessResult | Receives the data pointer created by GetStructurePointer(TwainMemory) after being
processed by Twain. | |
| ToString | Returns a string that represents the current object. (Inherited from Object.) |
public bool PreFilterMessage(ref Message m) { try { TwainEventMessage msg; TwainReturnCode ret = this.twain.ProcessEvent(m, out msg); if (ret == TwainReturnCode.TWRC_DSEVENT) { switch(msg) { case TwainEventMessage.MSG_DEVICEEVENT: if (this.DeviceEvent != null) { // Find out what ever fired. TwainDeviceEvent devEvent = new TwainDeviceEvent(); ret = this.twain.SendCommand(TwainTriplet.DeviceEventGet, this._id, devEvent); if ((ret & TwainReturnCode.TWRC_FAILURE) != TwainReturnCode.TWRC_FAILURE) { DeviceEventArgs e = null; switch(devEvent.Event) { ..... } } } break; } } } catch { } }
Public Function PreFilterMessage(ByRef m As Message) As Boolean Try Dim msg As TwainEventMessage Dim ret As TwainReturnCode = Me.twain.ProcessEvent(m,out msg) If ret = TwainReturnCode.TWRC_DSEVENT Then Select Case msg Case TwainEventMessage.MSG_DEVICEEVENT If Not Me.DeviceEvent Is Nothing Then ' Find out what ever fired. Dim devEvent As TwainDeviceEvent = New TwainDeviceEvent() ret = Me.twain.SendCommand(TwainTriplet.DeviceEventGet, Me._id, devEvent) If (ret & TwainReturnCode.TWRC_FAILURE) <> TwainReturnCode.TWRC_FAILURE Then Dim e As DeviceEventArgs = Nothing Select Case devEvent.Event ..... End Select End If End If Exit Function End Select End If End Try End Function
public bool PreFilterMessage(ref Message m) { try { TwainEventMessage msg; TwainReturnCode ret = this.twain.ProcessEvent(m, out msg); if (ret == TwainReturnCode.TWRC_DSEVENT) { switch(msg) { case TwainEventMessage.MSG_DEVICEEVENT: if (this.DeviceEvent != null) { // Find out what ever fired. TwainDeviceEvent devEvent = new TwainDeviceEvent(); ret = this.twain.SendCommand(TwainTriplet.DeviceEventGet, this._id, devEvent); if ((ret & TwainReturnCode.TWRC_FAILURE) != TwainReturnCode.TWRC_FAILURE) { DeviceEventArgs e = null; switch(devEvent.Event) { ..... } } } break; } } } catch { } }
Public Function PreFilterMessage(ByRef m As Message) As Boolean Try Dim msg As TwainEventMessage Dim ret As TwainReturnCode = Me.twain.ProcessEvent(m,out msg) If ret = TwainReturnCode.TWRC_DSEVENT Then Select Case msg Case TwainEventMessage.MSG_DEVICEEVENT If Not Me.DeviceEvent Is Nothing Then ' Find out what ever fired. Dim devEvent As TwainDeviceEvent = New TwainDeviceEvent() ret = Me.twain.SendCommand(TwainTriplet.DeviceEventGet, Me._id, devEvent) If (ret & TwainReturnCode.TWRC_FAILURE) <> TwainReturnCode.TWRC_FAILURE Then Dim e As DeviceEventArgs = Nothing Select Case devEvent.Event ..... End Select End If End If Exit Function End Select End If End Try End Function