Glossary Item Box
This low level function initiates scanning.
|
Parameter |
Type |
Description |
|
hJob |
HTWAINJOB |
Handle to a TWAIN job returned from ScanLowInitTwainJob. |
|
nPages |
int |
Specifies the number of pages to acquire. |
|
wPixTypes |
WORD |
Specifies the color depth of the image data to be returned. |
|
nFlags |
int |
Specifies scanning options. |
|
lphDIB |
HANDLE FAR |
* Specifies a pointer to handle to DIB. Used when acquiring 1 page. |
Return Value
The return value is SCAN_OK if the function completed successfully. If the function fails it will return SCAN_FAILED.
Comments
When an image is acquired the function will send a WM_IMSCAN message to the hWnd associated with the job. The wParam parameter of the message contains a Handle to a DIB for the acquired image. If the Scan fails then no WM_IMSCAN message will be generated.
Define Value Description
The following options are defined for the xPixTypes parameter:
|
Define |
Value |
Description |
|
TWAIN_ANYTYPE |
0x00 |
Any Color format |
|
TWAIN_BW |
0x01 |
Black & White (1 Bit) |
|
TWAIN_GRAY |
0x02 |
Grayscale (4 or 8 Bit) |
|
TWAIN_PALETTE |
0x08 |
Color (4 or 8 Bit) |
|
TWAIN_RGB |
0x04 |
Color (24 Bit) |
Define Value Description
The following options are defined for the nFlags parameter:
|
Define |
Value |
Description |
|
TWAIN_SHOWUI |
0x02 |
Display Scanner U/I Dialog |
|
TWAIN_USEADF |
0x01 |
Use ADF (If available) |
Example
#include imtwain.h
HTWAINJOB hJob;
hJob = ScanLowInitTwainJob( hWnd );
if( hJob ) {
// Scan 2 B/W pages using the ADF, without the U/I
ScanLowAcquirePages( hJob, 2, TWAIN_BW, TWAIN_USEADF, NULL );
ScanLowCloseJob( hJob );
}
...
// Code in Window Handler
HANDLE hImage;
CASE WM_IMSCAN:
//
// wp is the wParam of the Window procedure
//
if( wp ) {
hImage = ImgFromDIB( (HANDLE)wp );
// hImage is now a legitimate ImageMan Image Handle
}
Copyright 2008 Data Techniques, Inc. All Rights Reserved