Knowledge Base Nr: 00069 scan_ocx_sample.cpp - http://www.swe-kaiser.de

Downloads:

Win32: Sample for Scanning Images via Twain through NT's Scan Control.

  
//Within VC-Resource Editor use "Insert ActiveX Control" -> "Wang Image Scan Control"
//to get access to the COM object.
//The scanned image is saved to disc and not displayed on screen.
//Create a member variable for the Control. (In our sample 'm_scan' is used.)

void CScan_ocx_testDlg::OnScan()
{
CString strFilename = "image.tif";
m_scan.SetImage(strFilename);

BOOL bCallScannerSetup = TRUE;
m_scan.SetShowSetupBeforeScan(bCallScannerSetup);

BOOL bBMPinsteadTIF = FALSE;
m_scan.SetFileType(bBMPinsteadTIF ? 3 : 1);

m_scan.OpenScanner();
m_scan.StartScan();
m_scan.CloseScanner();
}