Insert Example VC++

This example demonstrates how to insert pages into a file.

void CAdmin1Dlg::OnInsert() 
{
    CString strOrigFile, strInsertFile;
    // This is the displayed image into which we insert the page.
    ImgAdmin1.SetImage ("D:\\image2\\original.tif");
    //Because we will use the dialog box to pick the file to be inserted
    //we need to save the original file.
    strOrigFile = ImgAdmin1.GetImage();
    ImgAdmin1.SetDialogTitle ("Select the file you want to 
        insert into the displayed image");
    VARIANT vhWnd; V_VT(&vhWnd) =  VT_I4;
    V_I4(&vhWnd) = (long)m_hWnd;
    ImgAdmin1.ShowFileDialog (0,vhWnd);   // OpenDlg
    strInsertFile = ImgAdmin1.GetImage();
    // Restore image property to the original filename because
    // this property must contain destination file.
    ImgAdmin1.SetImage(strOrigFile);
    //Insert 2 pages starting with page 1 of the source file,
    //which will be placed before page 3 in the original file. The
    //compression type of the source file will be retained since a
    //different compression type is not specified.
    VARIANT evt;
    evt.vt = VT_ERROR;  // set to error for optional parameter
    ImgAdmin1.Insert (strInsertFile, 1, 3, 2 , evt, evt);
}