K
kaithink
Unregistered / Unconfirmed
GUEST, unregistred user!
//---------------------------------------------------------------------------
#include <vcl.h>
#include <dir.h>
#include "xxxstruct.h"
#include "xxxctrl.h"
#include "xxxtags.h"
#include "xxxerr.h"
#pragma hdrstop
#include "main.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "CSPIN"
#pragma resource "*.dfm"
TMainForm *MainForm;
xxxLoadProc xxxLoad;
xxxFreeProc xxxFree;
xxxSelectSourceProc xxxSelectSource;
xxxAcquireProc xxxAcquire;
xxxSetValueProc xxxSetValue;
xxxGetValueProc xxxGetValue;
xxxSetPropProc xxxSetProp;
xxxGetTagFlagProc xxxGetTagFlag;
xxxGetTagChoiceProc xxxGetTagChoice;
float fMaxWidth,fMaxHeight;
/***************************************************************************
*
* FUNCTION: GetImage(void *ptr, long *size, long status)
*
* ptr: 1.) pointer, handle, file name or LA_IMAGEINFOLV1 structure
* 2.) ptr can in and out
* size: 1.) if status=RC_IMAGEINFO, size is ignore
* 2.) if status!=RC_IMAGEINFO then the size only use on memory scan(pointer)
* and it's return size back to app
* 3.) size can in and out
* status: tell app current status, if status is RC_IMAGEINFO, ptr is LA_IMAGEINFOLV1 struct
*
****************************************************************************/
long WINAPI GetImage(void *ptr, unsigned long *size, long status)
{
HGLOBAL hDIB;
pxxxIMAGEINFO pInfo;
if (status==RC_IMAGEINFO) //Get Scanning setting
pInfo=(pxxxIMAGEINFO)ptr;
if (status == RC_XFERDONE)
hDIB = *(HANDLE *)ptr;
if (status == RC_XFERDONE){
// Get rid of old image first, because this App only deals with one
GlobalUnlock(hDIB);
GlobalFree(hDIB);
}
return RC_SUCCESS;
}
//---------------------------------------------------------------------------
__fastcall TMainForm::TMainForm(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::FormShow(TObject *Sender)
{
curdir=GetCurrentDir();
ImgTypeComboBox->ItemIndex=0;
ResComboBox->Items->Clear();
ResComboBox->Items->Add("100");
ResComboBox->Items->Add("150");
ResComboBox->Items->Add("200");
ResComboBox->Items->Add("250");
ResComboBox->Items->Add("300");
ResComboBox->Items->Add("350");
ResComboBox->Items->Add("400");
ResComboBox->Items->Add("450");
ResComboBox->Items->Add("500");
ResComboBox->Items->Add("600");
ResComboBox->Items->Add("1200");
ResComboBox->ItemIndex=2;
SizeComboBox->Items->Clear();
SizeComboBox->Items->Add("A4");
SizeComboBox->Items->Add("Letter");
SizeComboBox->Items->Add("B5");
SizeComboBox->Items->Add("A5");
SizeComboBox->Items->Add("Bussiness Card");
SizeComboBox->Items->Add("3x5");
SizeComboBox->Items->Add("4x6");
SizeComboBox->Items->Add("Legal");
SizeComboBox->Items->Add("A3");
SizeComboBox->ItemIndex=1;
bAction=false;
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::BrightTrackBarChange(TObject *Sender)
{
BrightLabel->Caption=IntToStr(BrightTrackBar->Position);
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::ContrastTrackBarChange(TObject *Sender)
{
ContrastLabel->Caption=IntToStr(ContrastTrackBar->Position);
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::HighlightScrollBarChange(TObject *Sender)
{
HighlightLabel->Caption=IntToStr(HighlightScrollBar->Position);
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::ShadowScrollBarChange(TObject *Sender)
{
ShadowLabel->Caption=IntToStr(ShadowScrollBar->Position);
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::ScanMethodRadioGroupClick(TObject *Sender)
{
if (ScanMethodRadioGroup->ItemIndex==0)
DuplexCheckBox->Enabled=true;
else DuplexCheckBox->Enabled=false;
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::SelectButtonClick(TObject *Sender)
{
HINSTANCE hTwain;
LONG Err;
chdir(curdir.c_str());
hTwain = LoadLibrary("emgscan.dll");
if (hTwain>0){
xxxSelectSource = (xxxSelectSourceProc)GetProcAddress(hTwain, "xxxSelectSource");
xxxLoad = (xxxLoadProc)GetProcAddress(hTwain, "xxxLoad");
xxxFree = (xxxFreeProc)GetProcAddress(hTwain, "xxxFree");
if (xxxLoad)
Err=xxxLoad(Handle);
if (Err==RC_SUCCESS)
xxxSelectSource();
xxxFree;
}
FreeLibrary(hTwain);
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::CloseButtonClick(TObject *Sender)
{
Close();
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::ScanButtonClick(TObject *Sender)
{
xxx_PROP twProp;
HINSTANCE hTwain;
LONG Err,flags,nSetVal,nGetVal;
void *pValue;
unsigned short CapId;
unsigned short CapMsg;
char szLString[256];
xxx_FLOAT fGamma;
xxx_SHORT shortvalue;
int nOpticalRes;
chdir(curdir.c_str());
hTwain = LoadLibrary("emgscan.dll");
if (hTwain>0){
xxxLoad = (xxxLoadProc)GetProcAddress(hTwain, "xxxLoad");
xxxFree = (xxxFreeProc)GetProcAddress(hTwain, "xxxFree");
xxxAcquire = (xxxAcquireProc)GetProcAddress(hTwain, "xxxAcquire");
xxxSetValue = (xxxSetValueProc)GetProcAddress(hTwain, "xxxSetValue");
xxxGetValue = (xxxGetValueProc)GetProcAddress(hTwain, "xxxGetValue");
xxxSetProp = (xxxSetPropProc)GetProcAddress(hTwain, "xxxSetProp");
xxxGetTagFlag = (xxxGetTagFlagProc)GetProcAddress(hTwain, "xxxGetTagFlag");
xxxGetTagChoice = (xxxGetTagChoiceProc)GetProcAddress(hTwain, "xxxGetTagChoice");
if (xxxLoad)
Err=xxxLoad(Handle);
if (Err==RC_SUCCESS){
xxxGetTagFlag(xxx_XRESOLUTION, &flags);
xxxGetTagChoice(xxx_XRESOLUTION, xxx_RANGE_MAX, &nOpticalRes);
/*Get the maximun scanning width*/
CapId = xxx_PHYSICALWIDTH;
pValue=&fMaxWidth;
xxxGetValue(CapId, pValue);
/*Get the maximun scanning length*/
CapId = xxx_PHYSICALHEIGHT;
pValue=&fMaxHeight;
Err=xxxGetValue(CapId, pValue);
if (UICheckBox->Checked)
twProp.ShowUI = 1;
else twProp.ShowUI = 0;
twProp.Brightness=1000-((20-BrightTrackBar->Position)*100); //-1000 to 1000
twProp.Contrast=1000-((20-ContrastTrackBar->Position)*100); //-1000 to 1000
twProp.TransMode =xxx_TRANSFERMODE_HANDLE;
CapId = xxx_FILTER;
pValue=&shortvalue;
Err=xxxGetValue(CapId,pValue); //Get the default value for Color filter
twProp.Filter=shortvalue;
switch (ImgTypeComboBox->ItemIndex){
case 0://Lineart
twProp.PixelType =xxx_PIXELTYPE_BW;
twProp.BitsPerPixel=1;
CapId = xxx_DITHER;
strcpy(szLString,"None");
Err=xxxSetValue(CapId, szLString);
break;
case 1://Halftone
twProp.PixelType =xxx_PIXELTYPE_BW;
twProp.BitsPerPixel=1;
CapId = xxx_DITHER;
strcpy(szLString,"Halftone 1");
xxxSetValue(CapId, szLString);
break;
case 2://Gray
twProp.PixelType =xxx_PIXELTYPE_GRAY;
twProp.BitsPerPixel = 8;
break;
case 3://True color
twProp.PixelType =xxx_PIXELTYPE_RGB;
twProp.BitsPerPixel = 24;
break;
}
switch (ResComboBox->ItemIndex){
case 0:
twProp.XRes =100;
twProp.YRes =100;
break;
case 1:
twProp.XRes =150;
twProp.YRes =150;
break;
case 2:
twProp.XRes =200;
twProp.YRes =200;
break;
case 3:
twProp.XRes =250;
twProp.YRes =250;
break;
case 4:
twProp.XRes =300;
twProp.YRes =300;
break;
case 5:
twProp.XRes =350;
twProp.YRes =350;
break;
case 6:
twProp.XRes =400;
twProp.YRes =400;
break;
case 7:
twProp.XRes =450;
twProp.YRes =450;
break;
case 8:
twProp.XRes =500;
twProp.YRes =500;
break;
case 9:
twProp.XRes =600;
twProp.YRes =600;
break;
case 10:
twProp.XRes =1200;
twProp.YRes =1200;
break;
}
if (twProp.XRes>nOpticalRes){
twProp.XRes=nOpticalRes;
twProp.YRes =twProp.XRes;
}
twProp.Size.Unit=xxx_UNITS_INCH;
twProp.Size.DefPaper = 0;
twProp.Size.left=0;
twProp.Size.top=0;
switch (SizeComboBox->ItemIndex){
case 0://A4
twProp.Size.DefPaper=0;
twProp.Size.width=8.27;
twProp.Size.length=11;
break;
case 1://Letter
twProp.Size.DefPaper=0;
twProp.Size.width=8.27;
twProp.Size.length=11.69;
break;
case 2://B5
twProp.Size.DefPaper=0;
twProp.Size.width=8.27;
twProp.Size.length=11.69;
break;
case 3://A5
twProp.Size.DefPaper=0;
twProp.Size.width=5.83;
twProp.Size.length=8.27;
break;
case 4://Bussiness card
twProp.Size.DefPaper=0;
twProp.Size.width=4;
twProp.Size.length=2.5;
break;
case 5://3x5
twProp.Size.DefPaper=0;
twProp.Size.width=5.0;
twProp.Size.length=3.0;
break;
case 6://4x6
twProp.Size.DefPaper=0;
twProp.Size.width=6;
twProp.Size.length=4.0;
break;
case 7://Legal
twProp.Size.DefPaper=0;
twProp.Size.width=8.5;
twProp.Size.length=14;
break;
case 8://A3
twProp.Size.DefPaper=0;
twProp.Size.width=11.68;
twProp.Size.length=16.54;
break;
}
if (twProp.Size.width>fMaxWidth)
twProp.Size.width=fMaxWidth;
if (twProp.Size.length>fMaxHeight)
twProp.Size.length=fMaxHeight;
if (ColormatchCheckBox->Checked)
CapId = 1;
else CapId = 0;
pValue=&CapId;
xxxSetValue(xxx_COLORMATCH, pValue);
switch (ScanMethodRadioGroup->ItemIndex){
case 0://ADF
pValue=&CapMsg;
xxxGetValue(xxx_FEEDERSTATUS, pValue);
if (CapMsg==xxx_FEEDERSTATUS_LOAD){
twProp.ScanMethod=xxx_SCANTYPE_FEEDER;
if (DuplexCheckBox->Checked)
CapMsg=xxx_FEEDER_DUPLEX;
else CapMsg=xxx_FEEDER_SIMPLEX;
pValue=&CapMsg;
xxxSetValue(xxx_FEEDERTYPE, pValue);
twProp.Size.left=(fMaxWidth/2.0)-((twProp.Size.width)/2.0);
CapId=1;
xxxSetValue(xxx_XFERCOUNT, &CapId); //Set sheet feeder to scan one page
}else twProp.ScanMethod= xxx_SCANTYPE_FLATBED;
break;
case 1:twProp.ScanMethod= xxx_SCANTYPE_FLATBED;
}
CapId=1;
xxxSetValue(xxx_INDICATORS, &CapId);
if (DescreenCheckBox->Checked)
CapId=1;
else CapId=0;
xxxSetValue(xxx_DESCREEN, &CapId);
Err = xxxSetProp(twProp);
if (Err == RC_SUCCESS){
if (InvertCheckBox->Checked)
CapMsg = 1;
else CapMsg = 0;
pValue=&CapMsg;
xxxSetValue(xxx_INVERT, &CapMsg);
CapMsg=HighlightScrollBar->Position;
pValue=&CapMsg;
xxxSetValue(xxx_HIGHLIGHT, pValue);
CapMsg=ShadowScrollBar->Position;
pValue=&CapMsg;
xxxSetValue(xxx_SHADOW, pValue);
fGamma=GammaSpinEdit->Value/100;
pValue=&fGamma;
xxxSetValue(xxx_GAMMA, pValue);
xxxAcquire(GetImage);
}
}
xxxFree;
}
FreeLibrary(hTwain);
}
//---------------------------------------------------------------------------
#include <vcl.h>
#include <dir.h>
#include "xxxstruct.h"
#include "xxxctrl.h"
#include "xxxtags.h"
#include "xxxerr.h"
#pragma hdrstop
#include "main.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "CSPIN"
#pragma resource "*.dfm"
TMainForm *MainForm;
xxxLoadProc xxxLoad;
xxxFreeProc xxxFree;
xxxSelectSourceProc xxxSelectSource;
xxxAcquireProc xxxAcquire;
xxxSetValueProc xxxSetValue;
xxxGetValueProc xxxGetValue;
xxxSetPropProc xxxSetProp;
xxxGetTagFlagProc xxxGetTagFlag;
xxxGetTagChoiceProc xxxGetTagChoice;
float fMaxWidth,fMaxHeight;
/***************************************************************************
*
* FUNCTION: GetImage(void *ptr, long *size, long status)
*
* ptr: 1.) pointer, handle, file name or LA_IMAGEINFOLV1 structure
* 2.) ptr can in and out
* size: 1.) if status=RC_IMAGEINFO, size is ignore
* 2.) if status!=RC_IMAGEINFO then the size only use on memory scan(pointer)
* and it's return size back to app
* 3.) size can in and out
* status: tell app current status, if status is RC_IMAGEINFO, ptr is LA_IMAGEINFOLV1 struct
*
****************************************************************************/
long WINAPI GetImage(void *ptr, unsigned long *size, long status)
{
HGLOBAL hDIB;
pxxxIMAGEINFO pInfo;
if (status==RC_IMAGEINFO) //Get Scanning setting
pInfo=(pxxxIMAGEINFO)ptr;
if (status == RC_XFERDONE)
hDIB = *(HANDLE *)ptr;
if (status == RC_XFERDONE){
// Get rid of old image first, because this App only deals with one
GlobalUnlock(hDIB);
GlobalFree(hDIB);
}
return RC_SUCCESS;
}
//---------------------------------------------------------------------------
__fastcall TMainForm::TMainForm(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::FormShow(TObject *Sender)
{
curdir=GetCurrentDir();
ImgTypeComboBox->ItemIndex=0;
ResComboBox->Items->Clear();
ResComboBox->Items->Add("100");
ResComboBox->Items->Add("150");
ResComboBox->Items->Add("200");
ResComboBox->Items->Add("250");
ResComboBox->Items->Add("300");
ResComboBox->Items->Add("350");
ResComboBox->Items->Add("400");
ResComboBox->Items->Add("450");
ResComboBox->Items->Add("500");
ResComboBox->Items->Add("600");
ResComboBox->Items->Add("1200");
ResComboBox->ItemIndex=2;
SizeComboBox->Items->Clear();
SizeComboBox->Items->Add("A4");
SizeComboBox->Items->Add("Letter");
SizeComboBox->Items->Add("B5");
SizeComboBox->Items->Add("A5");
SizeComboBox->Items->Add("Bussiness Card");
SizeComboBox->Items->Add("3x5");
SizeComboBox->Items->Add("4x6");
SizeComboBox->Items->Add("Legal");
SizeComboBox->Items->Add("A3");
SizeComboBox->ItemIndex=1;
bAction=false;
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::BrightTrackBarChange(TObject *Sender)
{
BrightLabel->Caption=IntToStr(BrightTrackBar->Position);
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::ContrastTrackBarChange(TObject *Sender)
{
ContrastLabel->Caption=IntToStr(ContrastTrackBar->Position);
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::HighlightScrollBarChange(TObject *Sender)
{
HighlightLabel->Caption=IntToStr(HighlightScrollBar->Position);
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::ShadowScrollBarChange(TObject *Sender)
{
ShadowLabel->Caption=IntToStr(ShadowScrollBar->Position);
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::ScanMethodRadioGroupClick(TObject *Sender)
{
if (ScanMethodRadioGroup->ItemIndex==0)
DuplexCheckBox->Enabled=true;
else DuplexCheckBox->Enabled=false;
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::SelectButtonClick(TObject *Sender)
{
HINSTANCE hTwain;
LONG Err;
chdir(curdir.c_str());
hTwain = LoadLibrary("emgscan.dll");
if (hTwain>0){
xxxSelectSource = (xxxSelectSourceProc)GetProcAddress(hTwain, "xxxSelectSource");
xxxLoad = (xxxLoadProc)GetProcAddress(hTwain, "xxxLoad");
xxxFree = (xxxFreeProc)GetProcAddress(hTwain, "xxxFree");
if (xxxLoad)
Err=xxxLoad(Handle);
if (Err==RC_SUCCESS)
xxxSelectSource();
xxxFree;
}
FreeLibrary(hTwain);
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::CloseButtonClick(TObject *Sender)
{
Close();
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::ScanButtonClick(TObject *Sender)
{
xxx_PROP twProp;
HINSTANCE hTwain;
LONG Err,flags,nSetVal,nGetVal;
void *pValue;
unsigned short CapId;
unsigned short CapMsg;
char szLString[256];
xxx_FLOAT fGamma;
xxx_SHORT shortvalue;
int nOpticalRes;
chdir(curdir.c_str());
hTwain = LoadLibrary("emgscan.dll");
if (hTwain>0){
xxxLoad = (xxxLoadProc)GetProcAddress(hTwain, "xxxLoad");
xxxFree = (xxxFreeProc)GetProcAddress(hTwain, "xxxFree");
xxxAcquire = (xxxAcquireProc)GetProcAddress(hTwain, "xxxAcquire");
xxxSetValue = (xxxSetValueProc)GetProcAddress(hTwain, "xxxSetValue");
xxxGetValue = (xxxGetValueProc)GetProcAddress(hTwain, "xxxGetValue");
xxxSetProp = (xxxSetPropProc)GetProcAddress(hTwain, "xxxSetProp");
xxxGetTagFlag = (xxxGetTagFlagProc)GetProcAddress(hTwain, "xxxGetTagFlag");
xxxGetTagChoice = (xxxGetTagChoiceProc)GetProcAddress(hTwain, "xxxGetTagChoice");
if (xxxLoad)
Err=xxxLoad(Handle);
if (Err==RC_SUCCESS){
xxxGetTagFlag(xxx_XRESOLUTION, &flags);
xxxGetTagChoice(xxx_XRESOLUTION, xxx_RANGE_MAX, &nOpticalRes);
/*Get the maximun scanning width*/
CapId = xxx_PHYSICALWIDTH;
pValue=&fMaxWidth;
xxxGetValue(CapId, pValue);
/*Get the maximun scanning length*/
CapId = xxx_PHYSICALHEIGHT;
pValue=&fMaxHeight;
Err=xxxGetValue(CapId, pValue);
if (UICheckBox->Checked)
twProp.ShowUI = 1;
else twProp.ShowUI = 0;
twProp.Brightness=1000-((20-BrightTrackBar->Position)*100); //-1000 to 1000
twProp.Contrast=1000-((20-ContrastTrackBar->Position)*100); //-1000 to 1000
twProp.TransMode =xxx_TRANSFERMODE_HANDLE;
CapId = xxx_FILTER;
pValue=&shortvalue;
Err=xxxGetValue(CapId,pValue); //Get the default value for Color filter
twProp.Filter=shortvalue;
switch (ImgTypeComboBox->ItemIndex){
case 0://Lineart
twProp.PixelType =xxx_PIXELTYPE_BW;
twProp.BitsPerPixel=1;
CapId = xxx_DITHER;
strcpy(szLString,"None");
Err=xxxSetValue(CapId, szLString);
break;
case 1://Halftone
twProp.PixelType =xxx_PIXELTYPE_BW;
twProp.BitsPerPixel=1;
CapId = xxx_DITHER;
strcpy(szLString,"Halftone 1");
xxxSetValue(CapId, szLString);
break;
case 2://Gray
twProp.PixelType =xxx_PIXELTYPE_GRAY;
twProp.BitsPerPixel = 8;
break;
case 3://True color
twProp.PixelType =xxx_PIXELTYPE_RGB;
twProp.BitsPerPixel = 24;
break;
}
switch (ResComboBox->ItemIndex){
case 0:
twProp.XRes =100;
twProp.YRes =100;
break;
case 1:
twProp.XRes =150;
twProp.YRes =150;
break;
case 2:
twProp.XRes =200;
twProp.YRes =200;
break;
case 3:
twProp.XRes =250;
twProp.YRes =250;
break;
case 4:
twProp.XRes =300;
twProp.YRes =300;
break;
case 5:
twProp.XRes =350;
twProp.YRes =350;
break;
case 6:
twProp.XRes =400;
twProp.YRes =400;
break;
case 7:
twProp.XRes =450;
twProp.YRes =450;
break;
case 8:
twProp.XRes =500;
twProp.YRes =500;
break;
case 9:
twProp.XRes =600;
twProp.YRes =600;
break;
case 10:
twProp.XRes =1200;
twProp.YRes =1200;
break;
}
if (twProp.XRes>nOpticalRes){
twProp.XRes=nOpticalRes;
twProp.YRes =twProp.XRes;
}
twProp.Size.Unit=xxx_UNITS_INCH;
twProp.Size.DefPaper = 0;
twProp.Size.left=0;
twProp.Size.top=0;
switch (SizeComboBox->ItemIndex){
case 0://A4
twProp.Size.DefPaper=0;
twProp.Size.width=8.27;
twProp.Size.length=11;
break;
case 1://Letter
twProp.Size.DefPaper=0;
twProp.Size.width=8.27;
twProp.Size.length=11.69;
break;
case 2://B5
twProp.Size.DefPaper=0;
twProp.Size.width=8.27;
twProp.Size.length=11.69;
break;
case 3://A5
twProp.Size.DefPaper=0;
twProp.Size.width=5.83;
twProp.Size.length=8.27;
break;
case 4://Bussiness card
twProp.Size.DefPaper=0;
twProp.Size.width=4;
twProp.Size.length=2.5;
break;
case 5://3x5
twProp.Size.DefPaper=0;
twProp.Size.width=5.0;
twProp.Size.length=3.0;
break;
case 6://4x6
twProp.Size.DefPaper=0;
twProp.Size.width=6;
twProp.Size.length=4.0;
break;
case 7://Legal
twProp.Size.DefPaper=0;
twProp.Size.width=8.5;
twProp.Size.length=14;
break;
case 8://A3
twProp.Size.DefPaper=0;
twProp.Size.width=11.68;
twProp.Size.length=16.54;
break;
}
if (twProp.Size.width>fMaxWidth)
twProp.Size.width=fMaxWidth;
if (twProp.Size.length>fMaxHeight)
twProp.Size.length=fMaxHeight;
if (ColormatchCheckBox->Checked)
CapId = 1;
else CapId = 0;
pValue=&CapId;
xxxSetValue(xxx_COLORMATCH, pValue);
switch (ScanMethodRadioGroup->ItemIndex){
case 0://ADF
pValue=&CapMsg;
xxxGetValue(xxx_FEEDERSTATUS, pValue);
if (CapMsg==xxx_FEEDERSTATUS_LOAD){
twProp.ScanMethod=xxx_SCANTYPE_FEEDER;
if (DuplexCheckBox->Checked)
CapMsg=xxx_FEEDER_DUPLEX;
else CapMsg=xxx_FEEDER_SIMPLEX;
pValue=&CapMsg;
xxxSetValue(xxx_FEEDERTYPE, pValue);
twProp.Size.left=(fMaxWidth/2.0)-((twProp.Size.width)/2.0);
CapId=1;
xxxSetValue(xxx_XFERCOUNT, &CapId); //Set sheet feeder to scan one page
}else twProp.ScanMethod= xxx_SCANTYPE_FLATBED;
break;
case 1:twProp.ScanMethod= xxx_SCANTYPE_FLATBED;
}
CapId=1;
xxxSetValue(xxx_INDICATORS, &CapId);
if (DescreenCheckBox->Checked)
CapId=1;
else CapId=0;
xxxSetValue(xxx_DESCREEN, &CapId);
Err = xxxSetProp(twProp);
if (Err == RC_SUCCESS){
if (InvertCheckBox->Checked)
CapMsg = 1;
else CapMsg = 0;
pValue=&CapMsg;
xxxSetValue(xxx_INVERT, &CapMsg);
CapMsg=HighlightScrollBar->Position;
pValue=&CapMsg;
xxxSetValue(xxx_HIGHLIGHT, pValue);
CapMsg=ShadowScrollBar->Position;
pValue=&CapMsg;
xxxSetValue(xxx_SHADOW, pValue);
fGamma=GammaSpinEdit->Value/100;
pValue=&fGamma;
xxxSetValue(xxx_GAMMA, pValue);
xxxAcquire(GetImage);
}
}
xxxFree;
}
FreeLibrary(hTwain);
}
//---------------------------------------------------------------------------