Objective Edit : Chapter 5 Sample Applications : EditDlg
EditDlg
View the EditDlg sample for insight on how to use SECEditCtrl in a dialog. The code in CEditDlgDlg::OnInitDialog() shows how to attach the SECEditCtrl to an edit control on a dialog template. It also demonstrates printing from a dialog.
Follow these steps to implement:
1. Add SECEditCtrlPrinter.cpp and .h into your project.
2. Add #include "afxprint.rc" to your resource includes.
3. Add #include "SECEditCtrlPrinter.h" to the .cpp file that will do the printing.
4. Add code to print your SECEditCtrl's contents:
 
void CEditDlgDlg::OnPrint()
{
// Print the SECEdit that is in this SECEditCtrl
SECEditCtrlPrinter printer(&m_SECEditCtrl);
 
// This brings up the printer dlg box first
printer.Print();
 
// This would print directly to the current default printer
// settings
// printer.Print(TRUE);
}
NOTE >> These same steps may be used to print an SECEditCtrl from a CFormView.
Figure 14 – EditDlg Sample