SftTree/DLL 7.5 - Tree Control
SftBox/OCX 5.0 - Combo Box Control
SftButton/OCX 3.0 - Button Control
SftMask/OCX 7.0 - Masked Edit Control
SftTabs/OCX 6.5 - Tab Control (VB6 only)
SftTree/OCX 7.5 - Tree Control
SftPrintPreview/DLL 2.0 - Print Preview Control (discontinued)
SftTree/DLL 7.5 - Tree Control
SftBox/OCX 5.0 - Combo Box Control
SftButton/OCX 3.0 - Button Control
SftDirectory 3.5 - File/Folder Control (discontinued)
SftMask/OCX 7.0 - Masked Edit Control
SftOptions 1.0 - Registry/INI Control (discontinued)
SftPrintPreview/OCX 1.0 - Print Preview Control (discontinued)
SftTabs/OCX 6.5 - Tab Control (VB6 only)
SftTree/OCX 7.5 - Tree Control
SftTabs/NET 6.0 - Tab Control (discontinued)
SftTree/NET 2.0 - Tree Control
Notifications can be handled by a Print Preview control's parent window or directly by the Print Preview control itself (in a derived class).
If you want to handle Windows notification messages sent by a Print Preview control to its parent (usually a class derived from CDialog or CView), add a message-map entry and a message-handler member function to the parent class for each notification.
Message-map entries take the following form for WM_COMMAND and WM_NOTIFY notifications:
ON_Notification( id, memberFxn )
The parent's function prototype is as follows:
/* for WM_COMMAND notifications */ afx_msg void memberFxn( ); /* for WM_NOTIFY notifications */ afx_msg void memberFxn(NMHDR * pNotifyStruct, LRESULT* result);
Notification specifies one of the available notification codes listed in Notifications. id specifies the child window ID of the control sending the notification and memberFxn is the name of the parent member function in your application which handles the notification.
// Event handler prototype added to dialog/window class afx_msg void OnStartPrinting(); afx_msg void OnPreviewClose(NMHDR* pnmh, LRESULT* result); afx_msg void OnPreviewHelp(NMHDR* pnmh, LRESULT* result); afx_msg void OnPreviewPageSetup(NMHDR* pnmh, LRESULT* result); BEGIN_MESSAGE_MAP(CPreviewDialog, CDialog) ON_SFTPRINTPREVIEWN_STARTPRINTING(IDC_PREVIEW, OnStartPrinting) ON_NM_SFTPRINTPREVIEW_CLOSE_CODE(IDC_PREVIEW, OnPreviewClose) ON_NM_SFTPRINTPREVIEW_HELP_CODE(IDC_PREVIEW, OnPreviewHelp) ON_NM_SFTPRINTPREVIEW_PAGESETUP_CODE(IDC_PREVIEW, OnPreviewPageSetup) END_MESSAGE_MAP() // Event handler implementation afx_msg void CPreviewDialog::OnStartPrinting() { SftPrintPreview_Print(m_Preview, m_hWnd); } afx_msg void CPreviewDialog::OnPreviewClose(NMHDR* pnmh, LRESULT* result) { NM_SFTPRINTPREVIEW_CLOSE* pNotifyStruct = (NM_SFTPRINTPREVIEW_CLOSE*) pnmh; SendMessage(WM_COMMAND, IDCANCEL); } afx_msg void CPreviewDialog::OnPreviewHelp(NMHDR* pnmh, LRESULT* result) { NM_SFTPRINTPREVIEW_HELP* pNotifyStruct = (NM_SFTPRINTPREVIEW_HELP*) pnmh; MessageBox(_T("Sorry, this sample application doesn't include online help."), _T("SftPrintPreview/DLL"), MB_OK|MB_TASKMODAL); } afx_msg void CPreviewDialog::OnPreviewPageSetup(NMHDR* pnmh, LRESULT* result) { NM_SFTPRINTPREVIEW_PAGESETUP* pNotifyStruct = (NM_SFTPRINTPREVIEW_PAGESETUP*) pnmh; SftPrintPreview_PageSetup(m_Preview, m_hWnd) }
By overriding the OnChildNotify function of an object derived from CSftPrintPreview, you can handle messages in the object's class. The parameters are as documented in Notifications. Please see the Visual C++ documentation for additional information regarding the OnChildNotify function. However, the use of message reflection as shown next is the preferred method to handle messages.
MFC defines the ON_CONTROL_REFLECT and ON_NOTIFY_REFLECT macros which allow adding notifications directly to the message map. SftPrintPreview/DLL implements all required macros based on ON_CONTROL_REFLECT and ON_NOTIFY_REFLECT. See the MFC documentation for more information on message reflection.
Message-map entries take the following form:
ON_Notification_REFLECT( memberFxn )
The function prototype is as follows:
/* for WM_COMMAND notifications */ afx_msg void memberFxn( ); /* for WM_NOTIFY notifications */ afx_msg void memberFxn(NMHDR * pNotifyStruct, LRESULT* result);
Notification specifies one of the available notification codes listed in Notifications. memberFxn is the name of the member function in your object's class which handles the notification.
BEGIN_MESSAGE_MAP(CTreePreview, CSftPrintPreview_View) ON_NM_SFTPRINTPREVIEW_HELP_CODE_REFLECT(OnNotifyHelpReflect) END_MESSAGE_MAP() afx_msg void CTreePreview::OnNotifyHelpReflect(NMHDR * pNotifyStruct, LRESULT* lResult) { MessageBox(_T("Sorry, this sample application doesn't include online help."), _T("SftPrintPreview/DLL"), MB_OK); *lResult = 0; }