Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Widgets - General questions or Mixed problems » PrintJob does not works on "large project"
Re: PrintJob does not works on "large project" [message #30557 is a reply to message #30509] Sat, 08 January 2011 13:15 Go to previous message
mirek is currently offline  mirek
Messages: 13980
Registered: November 2005
Ultimate Member
alex100 wrote on Wed, 05 January 2011 10:46

The problem arises from the code

printjob.cpp
::Execute0
if(!PrintDlg(&dlg)) 
{
    DWORD x= CommDlgExtendedError();



the CommDlgExtendedError returns 0x1008 which means
"A default printer does not exist."

How to solve this?



Again, the following small project runs well...
#include "teste2.h"



teste2::teste2()
{
	CtrlLayout(*this, "Window title");
	btBut <<= THISBACK(OnBut);
	

	
}

void teste2::OnBut(void)
{
	PrinterJob pj;
	Draw& w = pj;
	w.StartPage();
	w.DrawText(0, 0, "Hello world!", Roman(100));
	w.EndPage();
	
}

GUI_APP_MAIN
{
	teste2().Run();
}




It seems that it is something related with that project/executable...


Thanks

Alex


Well, the general approach I am using in cases like this (you have big project with strange behaviour of unknown source) is to "exclude" the code until it starts working.

E.g. rename "GUI_APP_MAIN" of above code to "DoTest", then put all of that to your project (temorarily) and call DoTest at beginning of your big app GUI_APP_MAIN. If it does not work, there is a bug in global constructor somewhere. If it works ok, start it moving down the code... until it stops - then you have identified what makes the error.



 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: GUI app arguments?
Next Topic: How to maximize printing area of the RichEdit Ctrl? [SOLVED]
Goto Forum:
  


Current Time: Sun Jun 02 12:24:19 CEST 2024

Total time taken to generate the page: 0.00828 seconds