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
This sample illustrates using a RichEdit control.
The source code is located at C:\Program Files (x86)\Softelvdm\SftPrintPreview OCX 1.0\Samples\VC++\PreviewRichEdit\PreviewRichEditDlg.cpp or C:\Program Files\Softelvdm\SftPrintPreview OCX 1.0\Samples\VC++\PreviewRichEdit\PreviewRichEditDlg.cpp (on 32-bit Windows versions).
/*static*/ DWORD CALLBACK CSftPrintPreviewDlg::EditStreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb) { HANDLE hFile = (HANDLE) dwCookie; DWORD dwdRead = 0; if (ReadFile(hFile, pbBuff, cb, &dwdRead, NULL)) { //_ASSERT(cb == dwdRead); *pcb = dwdRead; return 0; } return -1; } void CSftPrintPreviewDlg::LoadEditControlWithFile(const CString& strFileName) { HANDLE hFile = CreateFile(strFileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile != INVALID_HANDLE_VALUE) { CWaitCursor wait; EDITSTREAM es; es.dwCookie = (DWORD_PTR) hFile; // use our file handle as cookie es.dwError = 0; es.pfnCallback = EditStreamCallback; m_Edit.StreamIn(SF_RTF, es); // load file CloseHandle(hFile); } } BOOL CSftPrintPreviewDlg::OnInitDialog() { CDialog::OnInitDialog(); // Set the icon for this dialog. The framework does this automatically // when the application's main window is not a dialog SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon CRect rect; GetClientRect(&rect); m_Preview1.MoveWindow(0, 0, rect.Width(), rect.Height()); m_vPrintPreview1 = m_Preview1.GetControlUnknown(); ASSERT(m_vPrintPreview1 != NULL); // Load contents m_Edit.LimitText(0x7fffffff);//need all the space we can get LoadEditControlWithFile(CString(_T("..\\SftPrintPreview.rtf"))); // Connect the richedit control to the print preview control m_vPrintPreview1->ContentProviderCallback((long) m_Edit.m_hWnd, m_vPrintPreview1->RenderRichEdit, NULL); m_vPrintPreview1->Restart(restartSftPrintPreviewComplete); ShowWindow(SW_MAXIMIZE); return TRUE; // return TRUE unless you set the focus to a control } void CSftPrintPreviewDlg::OnSize(UINT nType, int cx, int cy) { CDialog::OnSize(nType, cx, cy); if (m_Preview1.m_hWnd) m_Preview1.MoveWindow(0, 0, cx, cy); } void CSftPrintPreviewDlg::OnPageSetupWantedSftPrintPreview1() { m_vPrintPreview1->PageSetup((long) m_hWnd); } void CSftPrintPreviewDlg::OnCloseWantedSftPrintPreview1() { OnOK(); } void CSftPrintPreviewDlg::OnHelpWantedSftPrintPreview1(LPCTSTR HelpName) { MessageBox(_T("Sorry, this sample doesn't offer a help file")); } BEGIN_EVENTSINK_MAP(CSftPrintPreviewDlg, CDialog) //{{AFX_EVENTSINK_MAP(CSftPrintPreviewDlg) ON_EVENT(CSftPrintPreviewDlg, IDC_SFTPRINTPREVIEW1, 8 /* CloseWanted */, OnCloseWantedSftPrintPreview1, VTS_NONE) ON_EVENT(CSftPrintPreviewDlg, IDC_SFTPRINTPREVIEW1, 6 /* HelpWanted */, OnHelpWantedSftPrintPreview1, VTS_BSTR) ON_EVENT(CSftPrintPreviewDlg, IDC_SFTPRINTPREVIEW1, 7 /* PageSetupWanted */, OnPageSetupWantedSftPrintPreview1, VTS_NONE) //}}AFX_EVENTSINK_MAP END_EVENTSINK_MAP()