Click or drag to resize

ITwainDataStructure Interface

This interface is used for data classes sent to the SendCommand(TwainTriplet, TwainIdentity, ITwainDataStructure) method.

Namespace:  Atalasoft.Twain
Assembly:  Atalasoft.DotTwain (in Atalasoft.DotTwain.dll) Version: (.NET 4.5.2, x86)
public interface ITwainDataStructure

The ITwainDataStructure type exposes the following members.

Public methodCode exampleGetStructurePointer
Creates the memory pointer containing data sent to TWAIN.
Public methodCode exampleIsSupportedCommand
Returns a value indicating whether the implementing class supports a specific TwainTriplet command.
Public methodCode exampleProcessResult
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).

ITwainDataCS (C#)
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)

    public void ProcessResult(TwainMemory memory)
        _handle = memory.ReadIntPtr();

    public bool IsSupportedCommand(Atalasoft.Twain.TwainTriplet command)
        return (command == TwainTriplet.AudioNativeXferGet);

ITwainDataVB (Visual Basic)
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
            Return _handle
        End Get
    End Property

    #Region "ITwainDataStructure Members"

    Public Sub GetStructurePointer(ByVal memory As TwainMemory)
    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
See Also