Hide

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

Display
Print

SFTPRINTPREVIEW_CONTENTWINDOWMESSAGE Preprocessor Symbol

The SFTPRINTPREVIEW_CONTENTWINDOWMESSAGE preprocessor symbol defines a private Windows message used for support of third-party controls.

#define SFTPRINTPREVIEW_CONTENTWINDOWMESSAGE "SftPrintPreviewContentMessage"

Parameters (SFTPRINTPREVIEW_CONTENTWINDOWMESSAGE Message)

wParam

Not used.

lParam

A pointer to a SFTPRINTPREVIEW_CALLBACKINFO structure. The window being called 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.

Comments

The SFTPRINTPREVIEW_CONTENTWINDOWMESSAGE preprocessor symbol defines a private Windows message used for support of third-party controls.

SftPrintPreview/DLL can be used to preview and print the contents of any window (including custom controls), as long as these controls implement the required support for SftPrintPreview/DLL.

This private Windows message is registered using the RegisterWindowMessage Windows API. Any control that wishes to be previewed or printed using SftPrintPreview/DLL can implement this message and the associated callback function. SftPrintPreview/DLL includes full support for SftTree/DLL 5.0, SftTree/OCX 5.0 (and up) and RichEdit controls.

When setting the SFTPRINTPREVIEW_CONTROL structure member hwndContent, SftPrintPreview/DLL sends a SFTPRINTPREVIEW_CONTENTWINDOWMESSAGE message to the specified window to determine whether it supports the SFTPRINTPREVIEW_DRAWINFOPROC callback.

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 (pWindowSpecificData->contentMessage != 0 && msg == pWindowSpecificData->contentMessage) {
        LPSFTPRINTPREVIEW_CALLBACKINFO lpCB = (LPSFTPRINTPREVIEW_CALLBACKINFO) lParam;
        lpCB->lpDrawInfoProc = SftTree_PrintCallback;
        lpCB->lpDrawPageWorkArea = (SFTPRINTPREVIEW_DWORD_PTR) pWindowSpecificData;
        return 1L;
    }
    return DefWindowProc(hwnd, msg, wParam, lParam);
}

BOOL CALLBACK SftTree_PrintCallback(LPSFTPRINTPREVIEW_DRAWINFO lpInfo)
{
    register PWINDATA pWindowSpecificData = (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(pWindowSpecificData, lpInfo);
            return TRUE;
    }
}

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


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