FileType Example VC++

This example shows how to insert a scanned page before page 1 of an existing image file.

void CNewscanDlg::OnInsertpage() 
{
    // This example shows how to insert a scanned page before
    // page 1 of an existing image.
    // Use the ImgAdmin control to select a file for display
    // in the ImgEdit control.
    VARIANT vhWnd; V_VT(&vhWnd) =  VT_I4;
    V_I4(&vhWnd) = (long)m_hWnd;
    ImgAdmin1.ShowFileDialog(0,vhWnd); // OpenDlg  // 0
    // Check to see if cancel was pressed...
    ImgEdit1.SetImage(ImgAdmin1.GetImage());
    ImgEdit1.Display();
    // For insert or append, set the Scan control's
    // Image property.
    ImgScan1.SetImage(ImgAdmin1.GetImage());
    // Multipage must be set to True in order to create
    // files with more than one page.
    ImgScan1.SetMultiPage(TRUE);
    ImgScan1.SetPageOption(3);  //InsertPages '3
    ImgScan1.SetPage (1);
    ImgScan1.SetFileType(1); // TIFF '1
    // Scan using the Scan Page dialog box.
    VARIANT vModal; V_VT(&vModal) = VT_BOOL;
    V_BOOL(&vModal) = TRUE;
    ImgScan1.ShowScanPage(vModal);
}