Hide

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

Display
Print

NM_SFTPRINTPREVIEW_PRINTERCHANGED_CODE Notification Code

The NM_SFTPRINTPREVIEW_PRINTERCHANGED_CODE notification code is sent when the current printer or current printer attributes have been modified.

NM_SFTPRINTPREVIEW_PRINTERCHANGED* pNtfy = (NM_SFTPRINTPREVIEW_PRINTERCHANGED*) lParam;

Parameters (WM_NOTIFY Message)

wParam

Contains the Print Preview control's control identifier.

lParam

Pointer to an NM_SFTPRINTPREVIEW_PRINTERCHANGED structure that contains information specific to this notification. The structure also contains a standard NMHDR structure, which has additional information about the control sending this notification.

Return Value

The return value is ignored.

Comments

The NM_SFTPRINTPREVIEW_PRINTERCHANGED_CODE notification code is sent when the current printer or current printer attributes have been modified.

The Print Preview control automatically reformats the displayed preview, so an application generally does not have to intercept this notification. It is intended for informational purposes only, in case the application wants to save the printer information in an external location (Registry, INI file, etc.).

The parent window of the Print Preview control receives the NM_SFTPRINTPREVIEW_PRINTERCHANGED_CODE notification code through the WM_NOTIFY message.

Example

C

LRESULT CALLBACK MainWindowProc(HWND hwndMain, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    switch (uMsg) {
        case WM_NOTIFY: {
            int id = (int) wParam;
            LPNMHDR pnmh = (LPNMHDR) lParam;
            switch (id) {
                case IDC_PREVIEW:
                switch (pnmh->code) {
                    case NM_SFTPRINTPREVIEW_PRINTERCHANGED_CODE:
                    // Printer has changed
                    break;
                }
                break;
            }
            break;
        }
    }
    return DefWindowProc(hwndMain, uMsg, wParam, lParam);
}

C++

BEGIN_MESSAGE_MAP(CPreviewDialog, CDialog)
    ON_NM_SFTPRINTPREVIEW_PRINTERCHANGED_CODE(IDC_PREVIEW, OnPreviewPrinterChanged)
END_MESSAGE_MAP()

afx_msg void CPreviewDialog::OnPreviewPrinterChanged(NMHDR* pnmh, LRESULT* result)
{
    NM_SFTPRINTPREVIEW_PRINTERCHANGED* pNotifyStruct = (NM_SFTPRINTPREVIEW_PRINTERCHANGED*) pnmh;
    // Printer changed
}

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


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