Returns the status of the current source.
nDefault is int = 0
// Acquisition as long as there are pages to load
nPageNum is int = 0
LOOP
// Digitalization in a BMP file
IF TwainToBMP("File" + NumToString(nPageNum + 1) + ".BMP",
False, // No user interface
nDefault, // Default image of the device
nDefault, // Default number of bits per pixel for the device
nDefault, // Default image resolution for the device
nDefault, // Default image contrast for the device
nDefault, // Default image brightness for the device
False, // Scan the document on a single side (no duplex)
True // Optimize the automatic load in the loader
) = False THEN
BREAK
END
nPageNum ++
// More pages?
IF TwainState() = tsUnloaded THEN BREAK
END
// At least one digitized page?
IF nPageNum = 0 THEN
Error("The digitization failed", ErrorInfo())
ELSE
Info(nPageNum + "pages have been scanned")
END
Syntax
<Result>: Real
Status of the Twain source corresponding to one of the following constants: | |
tsLoaded | The Twain manager is loaded. |
tsUnloaded | The Twain manager is not loaded. |
tsOpen | The Twain manager is opened. |
tsSourceEnabled | The source is enabled. |
tsSourceOpen | The source is opened. |
tsSourceReady | The source is ready to transfer data. |
tsSourceTransfer | The source is currently transferring data. |
Remarks
Managing the changes of pages
To acquire several pages using a TWAIN device, all you have to do is perform a loop operation that acquires a page and that ends when TwainState returns the tsUnloaded constant. The value of the constant indicates that the page loader of the TWAIN device is empty.
Operating mode in the 64-bit applications
In a 64-bit application, this function will automatically use the 64-bit Twain driver. The TWAIN cannot be used if this driver is not installed.