Creating an View from dialog-based application. 
Author Message
 Creating an View from dialog-based application.

Hi,

How do I create an view-output from within a simple function?
Ok, my goal is to print an html-file, so I thought I can load it into
a CHtmlView (maybe a class derrived from it) and use the
printing-stuff from CView::OnPrint()

I tried:

CDC dc;
CPrintDialog dlg;
if (dlg.DoModal() != IDOK) return;
dc.Attach(dlg.GetPrinterDC());
dc.StartDoc();
dc.StartPage();

// Initializing the Document
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDD_TESTPRINTHTML_DIALOG, // this is a dialog-resource... :-?
RUNTIME_CLASS(MyPrintDocument), // an clean, derrived CDocument
RUNTIME_CLASS(CFrameWnd), // just to specify something.
RUNTIME_CLASS(MyPrintView)); // an clean CView

Ok, so far so good, but how can I call the OnPrint() of my
"MyPrintView" ???

Hoping for help.
Immanuel Scholz



Sat, 03 Jan 2004 18:45:55 GMT  
 Creating an View from dialog-based application.
Hi Immanuel,

You can try the code below to get the view class.

POSITION pos;

pDocTemplate->OpenDocumentFile(NULL);

pos = pDocTemplate->GetFirstDocPosition();
MyPrintDocument *pDoc = (MyPrintDocument *)pDocTemplate->GetNextDoc(pos);
pos = test->GetFirstViewPosition();
MyPrintView *pView=( MyPrintView *)test->GetNextView(pos);

Regards,
Leo



Sun, 04 Jan 2004 17:16:16 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Need help creating a dialog base application for 1.52

2. creating toolbar on a dialog based application.

3. How to create a Dialog based Application with MainDlg hidden on startup

4. Struggling Newbie:, Creating a dialog-based application from AppWizard

5. How to create an array of edit boxes in a dialog based application

6. How to create a RESIZABLE DIALOG-Based Application

7. Resizing a dialog based app based on its view's size

8. Adding Another MFC Dialog to the Dialog base application

9. Trapping Keystrokes in a Dialog Box or Dialog based application

10. Executing modal tabbed dialog from a dialog-based application

11. Positioning of dialogs in a dialog based application

12. Replacing the dialog box of a dialog-based application

 

 
Powered by phpBB® Forum Software