This function displays the Print dialog and creates a device context.

[C++Builder]     HDC IKPrintDlg(HWND hWnd, HANDLE hDevMode, PTR_IKPRINT_DIALOG IkPrnDlg);
[Delphi]         function IKPrintDlg(hWnd: HWND; hDevMode: THandle; var IkPrnDlg: IKPRINT_DIALOG): HDC;

Parameters

Name Explanation
hWnd The window handle
hDevMode The handle of the DEVMODE structure (The handle retrieved by IKGetDevModeHandle)
IkPrnDlg The Print dialog settings

Return Value

Returns the device context if successful. Returns null (0) if unsuccessful.

Explanation

The IKPrintDlg function displays the Print dialog and creates a device context using the information specified. By setting hDevMode, the "Print" dialog can be displayed with the printer name and printing information. To use the current printer with its existing settings then set NULL or 0 in hDevMode. The IKPrintDlg member variable values are displayed in the "Print" dialog when it is initialized and changes made to those settings in the "Print" dialog box are returned to the member variables when the printing is complete. For more information, please refer to IKPRINT_DIALOG in the Structure Definitions and Explanations in the Ik10Print.dll, Ik10PrintA.dll, Ik10Print64.dll, Ik10Print64A.dll section. The device context is freed using the IKPrintDeleteDC function.

If the IKPrintDlg function is successful, the device context is returned which is used by the IKPrintStartDoc function.

Printing example code:

In C++Builder

    HDC hDC;
    IKPRINT_DIALOG IkPrnDlg;

    memset(&IkPrnDlg, 0x00, sizeof(IkPrnDlg));
   IkPrnDlg.Copies = 1;
   IkPrnDlg.Options = 0x4 | 0x8 | 0x100000
   hDC = IKPrintDlg(Form1->Handle, NULL, &IkPrnDlg);
    if (hDC == NULL) return;
    if (IKPrintStartDoc(hDC, Form1->Handle, "", "", "", "ImageKit Print Sample") != FALSE) {
       IKPrintStartPage(hDC);

       // Display image, draw text or shapes, etc.

      IKPrintEndPage(hDC);
      IKPrintEndDoc(hDC);
    }
    IKPrintDeleteDC(hDC);

In Delphi

    DC: HDC;
    IkPrnDlg: IKPRINT_DIALOG;

   FillChar(IkPrnDlg, SizeOf(IkPrnDlg), 0);
   IkPrnDlg.Copies := 1;
   IkPrnDlg.Options := $4 or $8 or $100000
   DC := IKPrintDlg(Form1.Handle, 0, IkPrnDlg);
    if DC = 0 then Exit;
    if (IKPrintStartDoc(DC, Form1.Handle, '', '', '', 'ImageKit Print Sample') <> False) then
    begin
       IKPrintStartPage(DC);

        // Display image, draw text or shapes, etc.

        IKPrintEndPage(DC);
        IKPrintEndDoc(DC);
    end;
    IKPrintDeleteDC(DC);

 

The ImageKit10 VCL is a product created by Newtone Corporation