Hide

SftPrintPreview/DLL 2.0 - Print Preview Control for C/C++

Display
Print

SFTPRINTPREVIEW_CALLBACKINFO Structure

The SFTPRINTPREVIEW_CALLBACKINFO structure is used with the SFTPRINTPREVIEW_CONTENTWINDOWMESSAGE private Windows message.

typedef struct tagSftPrintPreviewCallbackInfo {
    SFTPRINTPREVIEW_DRAWINFOPROC lpDrawInfoProc;
    SFTPRINTPREVIEW_DWORD_PTR lpDrawPageWorkArea;
} SFTPRINTPREVIEW_CALLBACKINFO, * LPSFTPRINTPREVIEW_CALLBACKINFO;
typedef const SFTPRINTPREVIEW_CALLBACKINFO * LPCSFTPRINTPREVIEW_CALLBACKINFO;

Members

lpDrawInfoProc

A callback routine of type SFTPRINTPREVIEW_DRAWINFOPROC, used by SftPrintPreview/DLL to render the window contents.

lpDrawPageWorkArea

An optional work area for the window's own use.

Comments

The SFTPRINTPREVIEW_CALLBACKINFO structure is used with the SFTPRINTPREVIEW_CONTENTWINDOWMESSAGE private Windows message.

The structure is used with the SFTPRINTPREVIEW_CONTENTWINDOWMESSAGE message to obtain a callback routine for rendering purposes from a window. The lParam parameter of the message points to a SFTPRINTPREVIEW_CALLBACKINFO structure. The window provides the callback routine lpDrawInfoProc and optionally a lpDrawPageWorkArea work area for its own use. The callback routine lpDrawInfoProc is used by SftPrintPreview/DLL to render the window contents.

SftPrintPreview/DLL includes full support for SftTree/DLL 5.0 (and up) and Rich Edit controls.

Example

C

UINT contentMessage;

...

contentMessage = RegisterWindowMessage(TEXT(SFTPRINTPREVIEW_CONTENTWINDOWMESSAGE);

...

LRESULT CALLBACK SftTree_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
    switch (msg) {

    // Standard Windows Messages
    ....

    if (pData->contentMessage != 0 && msg == pData->contentMessage) {
        LPSFTPRINTPREVIEW_CALLBACKINFO lpCB = (LPSFTPRINTPREVIEW_CALLBACKINFO) lParam;
        lpCB->lpDrawInfoProc = SftTree_PrintCallback;
        lpCB->lpDrawPageWorkArea = (SFTPRINTPREVIEW_DWORD_PTR) pData;
        return 1L;
    }
    return DefWindowProc(hwnd, msg, wParam, lParam);
}

BOOL CALLBACK SftTree_PrintCallback(LPSFTPRINTPREVIEW_DRAWINFO lpInfo)
{
    register PWINDATA pData = (PWINDATA) lpInfo->lpDrawPageWorkArea;

    switch (lpInfo->function) {
        default:
        case SFTPRINTPREVIEW_PRINT_INIT:
            return TRUE;
        case SFTPRINTPREVIEW_PRINT_TERM:
            return TRUE;
        case SFTPRINTPREVIEW_PRINT_CLEARCACHE:
            return TRUE;
        case SFTPRINTPREVIEW_PRINT_DIMENSIONS:
            lpInfo->contentWidth = lpInfo->maxContentWidth;
            lpInfo->iContentSizing = SFTPRINTPREVIEW_CONTENTSIZING_FIT;
            return TRUE;
        case SFTPRINTPREVIEW_PRINT_ONEPAGE:
            PrintOnePage(pData, lpInfo);
            return TRUE;
    }
}

See Also C/C++ API | C++ Classes | Notifications


Last Updated 08/13/2020 - (email)
© 2024 Softel vdm, Inc.