-
printing problem
I have problem with PrintPreview - my doc/view app has dialog where I'd like to initialise PrintView with following command CView::OnFilePrintPreview(), but there is an error *cannot access protected member declared in class 'CView'*. Can you help me wit this?
pozdr, Artur
-
You could for example do:
pWnd->SendMessage(WM_COMMAND, MAKELONG(ID_FILE_PRINTPREVIEW, 1), NULL);
This will trick MFC into thinking that the user has pressed a key combination that triggers the print preview. The framework will then call OnPrintPreview.
Replace ID_FILE_PRINTPREVIEW with whatever ID the menu item in the file menu has.
Another option is to insert a public member into your view class. This member will then call OnPrintPreview from within the class.