PrintImage Example VC++

This example prints the image that is currently displayed in the Image Edit control.  It uses the Print Dialog box in the Admin control to obtain parameters for the print out.

void CImgEdit1Dlg::OnPrint() 
{
    // This example will print the image that is displayed in ImageEdit
    // control. It uses the Print Dialog box in the Admin control to
    // obtain parameters for the print output.
    
    // Display an image
    ImgEdit1.SetImage("D:\\image2\\4page.tif");
    ImgEdit1.Display();
   
    // Set filename to be printed to the displayed file.
    // If this property is not set the dialog will not display
    ImgAdmin1.SetImage(ImgEdit1.GetImage());
    VARIANT vhWnd; V_VT(&vhWnd) =  VT_I4;
    V_I4(&vhWnd) = (long)m_hWnd;
    ImgAdmin1.ShowPrintDialog (vhWnd);
    
    VARIANT evt; V_VT(&evt) = VT_ERROR; // set to default
    ImgEdit1.PrintImage(evt, evt, evt, evt, evt, evt, evt);
}