Jump to content
Fabrizio The Cat

Unable to print

Recommended Posts

Hi all,

 

after serveral days of tests, i am unable to print with cpp builder 12 CE.

the simple code:

 

void __fastcall TMain::BitBtn1Click(TObject *Sender)
{
Printer()->PrinterIndex = 0;  // here i select the default printer: a laser printer but the result is the same for all printer on my pc

Printer()->BeginDoc();        // here an excetion is raised informing that the selected printer is invalid. 

}

 

(the link  https://stackoverflow.com/questions/67233197/cbuilder-printing-issues-on-certain-printers?noredirect=1#comment120336791_67233197 is not working)

 

Why i can't print??

Thank you for the patience and the help.

Fabrizio

Share this post


Link to post

Hi,

i have tried the simple executable above outside the debugger and it works with no error.

Then debugging the real program the problem appeared again, seems the 2nd time running it with errors in the subsequent code.

Launched the simple exe, no error. 

Then i was able to debug the code and correct it. Now with a correct source code after the line mentioned, subsequent runs of the program don't have problems.

Now i'm unable to reproduce this beaviour.

Seems that an erroneous code with exceptions raised (during debugging only?) can corrupt something (surely memory locations) and a subsequent call of a program outside the debugger can solve the situation. 

This seems to be a debugger problem that can't safely recover returning from a bad code: a simple program not in debug can execute the BeginDoc() and exit leaving the machine in good conditions.

 

What do you think about?

 

Thank you, Fabrizio

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×