You can scan to memory easily. If you don’t specify a filename, the scanner will scan to memory. In this case a DIB is generated. You will get a window message (WM_BI_SCANNING_DOCUMENT_FINISHED) in the BiTWAIN.dll and an event (Done) in BiTWAIN.ocx if the image scanned correctly.
BiTwain.dll
- Use the Acquire function with NULL parameter
BiTwain.ocx
- Set the Action property to TWSCAN_ACQUIRE and leave the FileAcquire property empty
[C++]
/* Acquire an image to memory */
#include “BiTwain.h”
/* 1. parameter: number of pages to scan It scans only one
page
2. parameter: the scans single page files or multipage
image */
SetAcquirePages(1, FALSE);
/* 1. parameter: Path and name of the file to scan */
Acquire(NULL);
[C#]
/* Acquire an image to memory */
‘ Path and name of the file to scan
BiTwain.FileAcquire = ““;
/* 1. parameter: number of pages to scan It scans only one
page
2. parameter: the scans single page files or multipage
image */
BiTwain.SetAcquirePages(1, false);
/* Start scanning */
BiTwain.Action =
(short)BITWAINLib.enumScanOperations.TWSCAN_ACQUIRE;