This function terminates the current print job.

[C++Builder/Visual C++]     BOOL IKPrintAbortDoc(HDC hDC);
[Delphi]         function IKPrintAbortDoc(hDC: HDC): LongBool;
[Visual Basic]   Function IKPrintAbortDoc(ByVal hDC As Long) As Long

Parameters

Name Explanation
hDC The device context retrieved by the IKPrintCreateDC, the IKPrintCreateDCEx, the IKPrintDialog, and the IKPrintDlg functions.

Return Value

Returns True (nonzero) if successful. Returns False (0) if unsuccessful.

Explanation

The IKPrintAbortDoc function terminates the current print job and erases everything the application has written to the device since the last call of the IKPrintStartDoc function. The IKPrintAbortDoc function should be used with the IKPrintStartDoc, IKPrintStartPage, IKPrintEndPage, and the IKPrintEndDoc functions and is written between IKPrintStartPage and IKPrintEndPage. Note: when ButtonName, Caption, and Message are set and the Cancel Printing dialog box is displayed, the ImageKit calls the IKPrintAbortDoc function internally so it is not necessary to use this function in such cases.


Example for terminating a print job:

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

    HDC hDC;

    int i;

    BOOL bAbort = TRUE;


    hDC = IKPrintCreateDC(NULL, "Default", NULL, 1);

    if (hDC == NULL) return;


    //In Visual C++ pass Form1->Handle into m_hWnd

    if (IKPrintStartDoc(hDC, Form1->Handle, "", "", "", "ImageKit Print Sample") != FALSE) {

        for (i = 0; i < 100; i++) {

            IKPrintStartPage(hDC);


            //code for drawing image text etc


            if (i == 50) {

                IKPrintAbortDoc(hDC);

                bAbort = TRUE;

            }

            IKPrintEndPage(hDC);

            if (bAbort) break;

        }

        IKPrintEndDoc(hDC);

    }

    IKPrintDeleteDC(hDC);


(2)Delphi

    DC: HDC;

    i: Integer;

    bAbort: Boolean;


    DC := IKPrintCreateDC(nil, 'Default', 0, 1);

    if DC = 0 then Exit;

    if (IKPrintStartDoc(DC, Form1.Handle, '', '', '', 'ImageKit Print Sample') <> False) then

    begin

        bAbort := False;

        for i := 0 to 99 do

        begin

            IKPrintStartPage(DC);


            //code for drawing image text etc


            if i = 50 then

            begin

                IKPrintAbortDoc(DC);

                bAbort := True;

            end;

            IKPrintEndPage(DC);

            if bAbort then Break;

        end;

        IKPrintEndDoc(DC);

    end;

    IKPrintDeleteDC(DC);


(3)Visual Basic

    Dim hDC As Long

    Dim i As Integer

    Dim bAbort As Boolean


    hDC = IKPrintCreateDC(vbNullString, "Default ", 0, 1)

    If hDC = 0 Then Exit Sub

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

        For i = 0 To 99

            bAbort = False

            IKPrintStartPage(hDC)


            'code for drawing image text etc...


            If i = 50 then

                IKPrintAbortDoc(hDC)

                bAbort = True

            End If

            IKPrintEndPage(hDC)

            If bAbort = True Then Exit For

        Next i

        IKPrintEndDoc(hDC)

    End If

    IKPrintDeleteDC(hDC)

 

The ImageKit10 ActiveX is a product created by Newtone Corporation