This example uses the ShowPrintDialog method to enable the user to specify printing parameters. The image displayed in the Image Edit control is then printed.
void CAdmin1Dlg::OnPrint()
{
// Display an image
ImgEdit1.SetImage ("D:\\image2\\4page.tif");
ImgEdit1.Display();
// Reset NumCopies in case user printed multiple copies last time.
ImgAdmin1.SetPrintNumCopies (1);
// If CancelError is true, an error is generated if user presses
// cancel. Trap the error to avoid trying to print the file.
ImgAdmin1.SetCancelError (TRUE);
// Set filename to be printed to the displayed file. If this property
// is not set the dialog box will not display.
ImgAdmin1.SetImage (ImgEdit1.GetImage());
VARIANT vhWnd; V_VT(&vhWnd) = VT_I4;
V_I4(&vhWnd) = (long)m_hWnd;
ImgAdmin1.ShowPrintDialog (vhWnd);
// Print the image using the parameters obtained from the print
// dialog box (ex. start page, end page etc.).
VARIANT vStart, vEnd, vOutputFormat, vAnnotations, evt;
evt.vt = VT_ERROR; // set to error for optional parameter
V_I4(&vStart) = ImgAdmin1.GetPrintStartPage();
V_I4(&vEnd) = ImgAdmin1.GetPrintEndPage();
V_I4(&vOutputFormat) = ImgAdmin1.GetPrintOutputFormat();
V_I4(&vAnnotations) = ImgAdmin1.GetPrintAnnotations();
ImgEdit1.PrintImage (vStart, vEnd, vOutputFormat,
vAnnotations, evt, evt, evt);
}