ITwainDataStructure Interface |
Namespace: Atalasoft.Twain
The ITwainDataStructure type exposes the following members.
Name | Description | |
---|---|---|
GetStructurePointer | Creates the memory pointer containing data sent to TWAIN. | |
IsSupportedCommand | Returns a value indicating whether the implementing class supports a specific TwainTriplet
command. | |
ProcessResult | Receives the TwainMemory created by GetStructurePointer(TwainMemory)
after being processed by TWAIN. |
Use this interface for custom Twain calls not implemented by DotTwain.
Implementors of this class should not dispose of the TwainMemory sent to ProcessResult(TwainMemory). The TwainController will dispose of the memory created by GetStructurePointer(TwainMemory).
public class TwainHandle : ITwainDataStructure { private IntPtr _handle = IntPtr.Zero; public TwainHandle(IntPtr handle) { _handle = handle; } public IntPtr Handle { get { return _handle; } } #region ITwainDataStructure Members public void GetStructurePointer(TwainMemory memory) { memory.Allocate(IntPtr.Size); memory.WriteIntPtr(_handle); } public void ProcessResult(TwainMemory memory) { _handle = memory.ReadIntPtr(); } public bool IsSupportedCommand(Atalasoft.Twain.TwainTriplet command) { return (command == TwainTriplet.AudioNativeXferGet); } #endregion }
Public Class TwainHandle Implements ITwainDataStructure Private _handle As IntPtr = IntPtr.Zero Public Sub New(ByVal handle As IntPtr) _handle = handle End Sub Public Readonly Property Handle() As IntPtr Get Return _handle End Get End Property #Region "ITwainDataStructure Members" Public Sub GetStructurePointer(ByVal memory As TwainMemory) memory.Allocate(IntPtr.Size) memory.WriteIntPtr(_handle) End Sub Public Sub ProcessResult(ByVal memory As TwainMemory) _handle = memory.ReadIntPtr() End Sub Public Function IsSupportedCommand(ByVal command As Atalasoft.Twain.TwainTriplet) As Boolean Return (command Is TwainTriplet.AudioNativeXferGet) End Function #End Region End Class