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

[C++Builder/Visual C++]     HDC IKPrintDlg(HWND hWnd, HANDLE hDevMode, PTR_IKPRINT_DIALOG IkPrnDlg);
[Delphi]         function IKPrintDlg(hWnd: HWND; hDevMode: THandle; var IkPrnDlg: IKPRINT_DIALOG): HDC;
[Visual Basic]   Function IKPrintDlg(ByVal hWnd As Long, ByVal hDevMode As Long, IkPrnDlg As IKPRINT_DIALOG) As Long

Parameters

Name Explanation
hWnd The window handle
hDevMode The handle of the DEVMODE structure (The handle retrieved by IKGetDevModeHandle or 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:

(1)C++Builder/Visual C++

    HDC hDC;

    IKPRINT_DIALOG IkPrnDlg;


    memset(&IkPrnDlg, 0x00, sizeof(IkPrnDlg));

   IkPrnDlg.Copies = 1;

   IkPrnDlg.Options = 0x4 | 0x8 | 0x100000

   //In Visual C++, pass Form1->Handle to m_hWnd

   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);


(2)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);


(3)Visual Basic

    Dim hDC As Long

    Dim IkPrnDlg As IKPRINT_DIALOG


   IkPrnDlg.Copies = 1

   IkPrnDlg.Options = &H4 Or &H8 Or &H100000

   hDC = IKPrintDlg(Form1.hWnd, 0, IkPrnDlg)

    If hDC = 0 Then Exit Sub

    If (IKPrintStartDoc(hDC, Form1.hWnd, "", "", "", "ImageKit Print Sample") <> False) Then

       IKPrintStartPage(hDC)


       'Display image, draw text or shapes, etc.


       IKPrintEndPage(hDC)

       IKPrintEndDoc(hDC)

    End If

    IKPrintDeleteDC(hDC)

 

The ImageKit10 ActiveX is a product created by Newtone Corporation