Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

Platforms to show: All Mac Windows Linux Cross-Platform

Next items

TwainMBS.Acquire(modal as boolean = false, showUI as boolean = true) as picture
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Twain MBS Picture Plugin 12.3 Yes Yes No No No
Function: Acquires a new picture.
Notes:
Lasterror is set.
Plugin asks for asynchronously operation, so this function returns nil and success in lasterror.
If data source must be used with modal UI, this function returns with picture.

Modal can be true to ask for modal dialog. Seems to be only supported on Mac.

Feedback, Comments & Corrections

TwainMBS.AllDevices as TwainIdentityMBS()
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Twain MBS Picture Plugin 12.3 Yes Yes No No No
Function: Returns array with all devices.
Example:
dim twain as TwainMBS // your twain object
dim devices() as TwainIdentityMBS = twain.AllDevices
dim found as Boolean
dim NameToFind as string = "MyScanner123"

for each device as TwainIdentityMBS in devices

if device.ProductName = NameToFind then
found = true

// lets use this one
twain.SelectDS(device)

if twain.Lasterror <> 0 then
MsgBox "Failed to select "+device.ProductName
else
'MsgBox "OK"
exit
end if
end if
next

if not found then
MsgBox "No scanner found named: "+NameToFind
end if

Feedback, Comments & Corrections

TwainMBS.AppIdentity as TwainIdentityMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Twain MBS Picture Plugin 12.3 Yes Yes No No No
Function: Queries app identity.
Notes: That's the identity the plugin used to register with twain library.

Feedback, Comments & Corrections

TwainMBS.CanBW as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Twain MBS Picture Plugin 12.3 Yes Yes No No No
Function: Whether device supports black and white pixel type.
Notes: Lasterror is set.

Feedback, Comments & Corrections

TwainMBS.CanGray as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Twain MBS Picture Plugin 12.3 Yes Yes No No No
Function: Whether device supports gray pixel type.
Notes: Lasterror is set.

Feedback, Comments & Corrections

TwainMBS.CanPalette as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Twain MBS Picture Plugin 12.3 Yes Yes No No No
Function: Whether current device supports palette pixel type.
Notes: Lasterror is set.

Feedback, Comments & Corrections

TwainMBS.CanRGB as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Twain MBS Picture Plugin 12.3 Yes Yes No No No
Function: Whether current device supports RGB pixel type.
Notes: Lasterror is set.

Feedback, Comments & Corrections

TwainMBS.CloseDS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Twain MBS Picture Plugin 12.3 Yes Yes No No No
Function: Close data source.
Notes: Lasterror is set.

Feedback, Comments & Corrections

TwainMBS.CloseDSM
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Twain MBS Picture Plugin 12.3 Yes Yes No No No
Function: Closes the data source manager.
Notes: Lasterror is set.

Feedback, Comments & Corrections

TwainMBS.Constructor(Country as Integer, Language as Integer)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Twain MBS Picture Plugin 12.3 Yes Yes No No No
Function: Initializes Twain engine with given localization.
Notes: Lasterror is set.

Feedback, Comments & Corrections

TwainMBS.DefaultDevice as TwainIdentityMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
property Twain MBS Picture Plugin 12.3 Yes Yes No No No
Function: The default device.
Notes: (Read and Write computed property)

Feedback, Comments & Corrections

TwainMBS.DisableDS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Twain MBS Picture Plugin 12.3 Yes Yes No No No
Function: Diables data source.
Notes: Lasterror is set.

Feedback, Comments & Corrections

TwainMBS.DontUnload
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Twain MBS Picture Plugin 12.5 Yes Yes No No No
Function: Informs the plugin to not unload the twain library.
Notes: This avoids a crash for some people.

Feedback, Comments & Corrections

TwainMBS.DSIdentity as TwainIdentityMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Twain MBS Picture Plugin 12.3 Yes Yes No No No
Function: Queries the details on the data source.
Notes: Lasterror is set.

Feedback, Comments & Corrections

TwainMBS.GetEnumerationCapability(ID as Integer, byref ItemType as Integer, byref Count as Integer, byref CurrentIndex as Integer, byref DefaultIndex as Integer) as Integer()
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Twain MBS Picture Plugin 15.0 Yes Yes No No No
Function: Queries an enum capability.
Example:
dim t as TwainMBS // your twain object

// check supported sizes

const ICAP_SUPPORTEDSIZES = &h1122
dim type5 as Integer
dim EnumCount as Integer = 0
dim EnumItemType as Integer = 0
dim EnumCurrentIndex as Integer = 0
dim EnumDefaultIndex as Integer = 0
dim EnumValues() as Integer = t.GetEnumerationCapability(ICAP_SUPPORTEDSIZES, EnumItemType, EnumCount, EnumCurrentIndex, EnumDefaultIndex)
dim e5 as Integer = t.Lasterror
dim c5 as Integer = t.ConditionCode
Notes:
Please review Twain Documentation for details.
Please open data source before via OpenDS method.
This should work fine for all integer enum types like boolean, 8, 16 or 32 bit integers.
Sets lasterror and condition code.
(if lasterror is 1 and condition code is 13, the capability is not supported)

Feedback, Comments & Corrections

TwainMBS.GetIntegerCapability(ID as Integer, byref Type as Integer) as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Twain MBS Picture Plugin 15.0 Yes Yes No No No
Function: Queries an integer capability.
Example:
dim t as TwainMBS // your twain object

t.OpenDS

if t.Lasterror <> 0 then
MsgBox "Failed to open device: "+str(t.Lasterror)
Return
end if

const CAP_FEEDERENABLED = &h1002
const CAP_FEEDERLOADED = &h1003
const TWRC_FAILURE = 1
const TWCC_CAPUNSUPPORTED = 13

// query before
dim type1 as Integer
dim n1 as Integer = t.GetIntegerCapability(CAP_FEEDERENABLED, type1)
dim e1 as Integer = t.Lasterror
dim c1 as Integer = t.ConditionCode

// set on
t.SetBoolCapability CAP_FEEDERENABLED, true
dim e2 as Integer = t.Lasterror
dim c2 as Integer = t.ConditionCode

// query after
dim type3 as Integer
dim n3 as Integer = t.GetIntegerCapability(CAP_FEEDERENABLED, type3)
dim e3 as Integer = t.Lasterror
dim c3 as Integer = t.ConditionCode

// now query loaded?
dim type4 as Integer
dim n4 as Integer = t.GetIntegerCapability(CAP_FEEDERLOADED, type4)
dim e4 as Integer = t.Lasterror
dim c4 as Integer = t.ConditionCode

if e4 = TWRC_FAILURE AND c4 = TWCC_CAPUNSUPPORTED then
// not supported!
Break
end if
Notes:
Please review Twain Documentation for details.
Please open data source before via OpenDS method.
This should work fine for all integer types like boolean, 8, 16 or 32 bit integers.
Sets lasterror and condition code.
(if lasterror is 1 and condition code is 13, the capability is not supported)

Feedback, Comments & Corrections

TwainMBS.ImageInfo as TwainImageInfoMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Twain MBS Picture Plugin 12.3 Yes Yes No No No
Function: Queries information about current image.
Notes: Lasterror is set.

Feedback, Comments & Corrections

TwainMBS.Imagelayout as TwainImageLayoutMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
property Twain MBS Picture Plugin 15.0 Yes Yes No No No
Function: Get/Set the image layout.
Notes:
Lasterror is set. DataSource must be open.
(Read and Write computed property)

Feedback, Comments & Corrections

TwainMBS.IsDSEnabled as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Twain MBS Picture Plugin 12.3 Yes Yes No No No
Function: Whether data source is enabled.

Feedback, Comments & Corrections

TwainMBS.OpenDS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Twain MBS Picture Plugin 12.3 Yes Yes No No No
Function: Opens the data source.

Feedback, Comments & Corrections

TwainMBS.OpenDSM
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Twain MBS Picture Plugin 12.3 Yes Yes No No No
Function: Opens Data source Manager.
Notes: Lasterror is set.

Feedback, Comments & Corrections

TwainMBS.ProcessEvents
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Twain MBS Picture Plugin 12.5 No Yes No No No
Function: Process events in plugin.
Notes:
Only for Windows needed for some Twain drivers. You call it after you run Acquire to let the plugin wait for the events to start the transfer.
When transfer is ready or dialog is cancelled, this method ends.
On Mac OS X or Linux this method does nothing so it's no problem calling it.

Feedback, Comments & Corrections

TwainMBS.SelectDS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Twain MBS Picture Plugin 12.3 Yes Yes No No No
Function: Queries dialog to ask the user to select a data source.
Notes: Lasterror is set.

See also:

Feedback, Comments & Corrections

TwainMBS.SelectDS(device as TwainIdentityMBS)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Twain MBS Picture Plugin 12.3 Yes Yes No No No
Function: Selects the given device without dialog.
Example:
dim twain as TwainMBS // your twain object
dim devices() as TwainIdentityMBS = twain.AllDevices
dim found as Boolean
dim NameToFind as string = "MyScanner123"

for each device as TwainIdentityMBS in devices

if device.ProductName = NameToFind then
found = true

// lets use this one
twain.SelectDS(device)

if twain.Lasterror <> 0 then
MsgBox "Failed to select "+device.ProductName
else
'MsgBox "OK"
exit
end if
end if
next

if not found then
MsgBox "No scanner found named: "+NameToFind
end if
Notes: Lasterror is set.

See also:

Feedback, Comments & Corrections

TwainMBS.SetBoolCapability(ID as Integer, Value as Boolean)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Twain MBS Picture Plugin 15.0 Yes Yes No No No
Function: Sets a capability with boolean.
Example:
dim t as TwainMBS // your twain object

t.OpenDS

if t.Lasterror <> 0 then
MsgBox "Failed to open device: "+str(t.Lasterror)
Return
end if

const CAP_FEEDERENABLED = &h1002
const CAP_FEEDERLOADED = &h1003
const TWRC_FAILURE = 1
const TWCC_CAPUNSUPPORTED = 13

// query before
dim type1 as Integer
dim n1 as Integer = t.GetIntegerCapability(CAP_FEEDERENABLED, type1)
dim e1 as Integer = t.Lasterror
dim c1 as Integer = t.ConditionCode

// set on
t.SetBoolCapability CAP_FEEDERENABLED, true
dim e2 as Integer = t.Lasterror
dim c2 as Integer = t.ConditionCode

// query after
dim type3 as Integer
dim n3 as Integer = t.GetIntegerCapability(CAP_FEEDERENABLED, type3)
dim e3 as Integer = t.Lasterror
dim c3 as Integer = t.ConditionCode

// now query loaded?
dim type4 as Integer
dim n4 as Integer = t.GetIntegerCapability(CAP_FEEDERLOADED, type4)
dim e4 as Integer = t.Lasterror
dim c4 as Integer = t.ConditionCode

if e4 = TWRC_FAILURE AND c4 = TWCC_CAPUNSUPPORTED then
// not supported!
Break
end if
Notes:
Please review Twain Documentation for details.
Please open data source before via OpenDS method.
You may see problems if you use this method on a capability which is not a boolean.
Sets lasterror and condition code.
(if lasterror is 1 and condition code is 13, the capability is not supported)

Feedback, Comments & Corrections

TwainMBS.SetFloatCapability(ID as Integer, Value as Double)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Twain MBS Picture Plugin 15.0 Yes Yes No No No
Function: Sets a capability with floating point value.
Notes:
Please review Twain Documentation for details.
Please open data source before via OpenDS method.
You may see problems if you use this method on a capability which is not a floating point value (FIX32).
Sets lasterror and condition code.
(if lasterror is 1 and condition code is 13, the capability is not supported)

Feedback, Comments & Corrections

TwainMBS.SetInt32Capability(ID as Integer, Value as Int32)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Twain MBS Picture Plugin 15.0 Yes Yes No No No
Function: Sets a capability with 32 bit integer.
Notes:
Please review Twain Documentation for details.
Please open data source before via OpenDS method.
You may see problems if you use this method on a capability which is not a 32 bit integer.
Sets lasterror and condition code.
(if lasterror is 1 and condition code is 13, the capability is not supported)

Feedback, Comments & Corrections

TwainMBS.SetUInt16Capability(ID as Integer, Value as UInt16)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Twain MBS Picture Plugin 15.0 Yes Yes No No No
Function: Sets a capability with 16 bit integer.
Notes:
Please review Twain Documentation for details.
Please open data source before via OpenDS method.
You may see problems if you use this method on a capability which is not a 16 bit integer.
Sets lasterror and condition code.
(if lasterror is 1 and condition code is 13, the capability is not supported)

Feedback, Comments & Corrections

TwainMBS.SupportsMemoryTransfer as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Twain MBS Picture Plugin 12.3 Yes Yes No No No
Function: Whether the twain data source supports memory transfers.
Notes: As our plugin uses only memory transfers, the source must support this in order to work with our plugin.

Feedback, Comments & Corrections

Next items

The items on this page are in the following plugins: MBS Picture Plugin.




Links
MBS Xojo PDF Plugins