Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / May 2005

Tip: Looking for answers? Try searching our database.

Fail to PrintContext without CDialog.DoModal call previously

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jürg Fross - 25 May 2005 21:07 GMT
Hi all,
I have to recompile a MFC++ Program developped under NT4.0 in XP. We store
the printer settings (DEVMODE and DEVNAMES) as part of our document. When
printing in batch mode, we need to create a PrintingContext without asking
the user. Here is my code fragment (I removed all error handling):

BOOL CTsprintView::OnPreparePrinting(CPrintInfo* pInfo) {
 // we get DEVMODE and DEVNAMES from the document...
....
 pDoc->setContext(pInfo);
 // now pInfo->m_pPD->m_pd.hDevMode and
 // pInfo->m_pPD->m_pd.hDevNames are set.

 // now we create the context:
 pInfo->m_pPD->CreatePrinterDC();  
 return true;
}

when starting the program as above, nothing gets printed. (And I see no
error messages). When I change the last line to

 pInfo->m_pPD->DoModal();  

the dialog gets popped up correcty with the right settings and printing
works as expected.

Any hints/help is welcome.

Thanks
Jürg
Jürg Fross - 25 May 2005 21:18 GMT
Oups, I was not totally correct, I may do get some error messages:

instead of printing, I get strange files with names like:

IP_10.0.0.1««««««««îþîþîþîþîþîþ

in my working directory. What do these files mean?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.