Append Example VC++

This example demonstrates how to append 3 image pages to a file.

void CAdmin1Dlg::OnAppend() 
{
    CString strOrigFile, strAppendFile;
    // This is the displayed image which we are going to append to
    ImgAdmin1.SetImage ("D:\\image2\\original.tif");
    // We will use the dialog box to pick the file for append
    // so we need to save the original file.
    strOrigFile = ImgAdmin1.GetImage();
    ImgAdmin1.SetDialogTitle ("Select the file to be appended
        to the displayed image");
    VARIANT vhWnd; V_VT(&vhWnd) =  VT_I4;
    V_I4(&vhWnd) = (long)m_hWnd;
    ImgAdmin1.ShowFileDialog (0,vhWnd);   // OpenDlg
    strAppendFile = ImgAdmin1.GetImage();
    // Restore image property to the original filename because
    // this property must contain destination file.
    ImgAdmin1.SetImage (strOrigFile);
    // User wants to append 3 pages starting with page 1
    VARIANT evt;
    evt.vt = VT_ERROR;   // set to error for optional parameter 
    ImgAdmin1.Append (strAppendFile, 1, 3, evt, evt);
}