|
|
| File Print Preview not working in existing code while compling from Visual studio 2005 |
|
| Author |
Message |
George78

|
Posted: Visual C++ Language, File Print Preview not working in existing code while compling from Visual studio 2005 |
Top |
I have some code which does some printing.It seems to work when you compile and run in visual studio 6 .While compiling and running in VS 2005 and clicking on the File print preview menu displays nothing.It just displays the original main frame window. In the Main app file the initinstance method is displayed as CSingleDocTemplate* pDocTemplate; pDocTemplate = new CSingleDocTemplate(IDR_MAINFRAME, RUNTIME_CLASS(CDpqwinDoc), RUNTIME_CLASS(CMainFrame), RUNTIME_CLASS(CDpqwinView));
AddDocTemplate(pDocTemplate);
......
but FOR printing purposes i use a seperate class Printview which calls the default CView::OnFilePrintPreview. Just before that i do the following void CPrintManager::CreateView() { //create a new template for the print view CSingleDocTemplate* pTemplate = new CSingleDocTemplate ( IDR_MAINFRAME, NULL, RUNTIME_CLASS( CFrameWnd ), RUNTIME_CLASS( CPrintView ) );
//create the frame window for this template m_pFrameWnd = pTemplate->CreateNewFrame( NULL, NULL );//m_pDocument, NULL ); //set the initial update for this frame (so we get a view) pTemplate->InitialUpdateFrame( m_pFrameWnd, NULL, FALSE ); //store the view m_pPrintView = (CPrintView*)m_pFrameWnd->GetActiveView();
//set the document and otherpointers for the view m_pPrintView->SetPrintOptions( m_pPrintOptions ); m_pPrintView->SetDocument( m_pDocument ); m_pPrintView->SetGraph( m_pGraph );
//we've finished with the template delete pTemplate; }
any clues , i have checked the IDs of AFxRes.h and they are the same in both
#define AFX_IDS_PRINTONPORT 0xF040 #define AFX_IDS_ONEPAGE 0xF041 #define AFX_IDS_TWOPAGE 0xF042 #define AFX_IDS_PRINTPAGENUM 0xF043 #define AFX_IDS_PREVIEWPAGEDESC 0xF044 #define AFX_IDS_PRINTDEFAULTEXT 0xF045 #define AFX_IDS_PRINTDEFAULT 0xF046 #define AFX_IDS_PRINTFILTER 0xF047 #define AFX_IDS_PRINTCAPTION 0xF048 #define AFX_IDS_PRINTTOFILE 0xF049
Visual C++16
|
| |
|
| |
 |
Bite Qiu - MSFT

|
Posted: Visual C++ Language, File Print Preview not working in existing code while compling from Visual studio 2005 |
Top |
|
| |
 |
| |
|