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





PostPosted: 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++11  
 
 
Bite Qiu - MSFT





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

Hello

Re: File Print Preview not working in existing code while compling from Visual studio 2005

Such questions are outside the scope of this forum - for the scope of the Visual C++ Language forum please look at: http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=789657&SiteID=1

The more appropriate place for your question is probably the MFC newsgroup: http://msdn.microsoft.com/newsgroups/default.aspx dg=microsoft.public.vc.mfc&lang=en&cr=US

OTP

Thanks

Bite