Board index » cppbuilder » Problems with TPrinter.

Problems with TPrinter.


2004-02-03 01:16:30 AM
cppbuilder54
Dear all,
I'm writing the routines to print the list of the program. I've detected a
problem with printer: if I take some time to print since last print out,
then TPrinter object doesn't create any print object in the print queue nor
C++Builder is not able to print any document.
IDE: C++Builder 6.0
OS: Win NT 4.0 Serv Pack 6
Printer: LaserJet 6P (local to computer)
Driver: included in WNT
To print once again, a Windows program (ie: Notepad) should be opened, then
type some letters and print them.
Has somebody found this problem? How to fix it?
Thanks and Best Regards.
Joaquim Duran
Sorry for my bad English.
 
 

Re:Problems with TPrinter.

"Joaquim Duran" < XXXX@XXXXX.COM >wrote:
Quote
[...] Has somebody found this problem?
Never heard of it before.
Quote
How to fix it?
Try making the TPrinter object local so that when the function
returns, the stack is unwound, thus effectively deleting the
TPrinter object.
~ JD
 

Re:Problems with TPrinter.

Well, I get a pointer to a TPrinter object by calling to Printer() function.
The documentation don't specify if a 'delete' is needed to deallocate the
TPrinter object or if the object is managed by VCL itself.
(In the VLC documentation example, no delete command is used.)
Joaquim Duran
Thanks and Best Regards,
"JD" < XXXX@XXXXX.COM >escribi?en el mensaje
Quote

"Joaquim Duran" < XXXX@XXXXX.COM >wrote:
>[...] Has somebody found this problem?

Never heard of it before.

>How to fix it?

Try making the TPrinter object local so that when the function
returns, the stack is unwound, thus effectively deleting the
TPrinter object.

~ JD

 

{smallsort}

Re:Problems with TPrinter.

Based in JD email, I've added the following lines to the program:
TPrinter *printer = Printer();
[...]
TPrinter *ptn = SetPrinter(NULL);
delete ptn;
This forces that TPrinter object gets destroyed.
Thanks and Best Regards,
Joaquim Duran
"Joaquim Duran" < XXXX@XXXXX.COM >escribi?en el mensaje
Quote
Well, I get a pointer to a TPrinter object by calling to Printer()
function.
The documentation don't specify if a 'delete' is needed to deallocate the
TPrinter object or if the object is managed by VCL itself.
(In the VLC documentation example, no delete command is used.)

Joaquim Duran
Thanks and Best Regards,


"JD" < XXXX@XXXXX.COM >escribi?en el mensaje
news:401efaa8$ XXXX@XXXXX.COM ...
>
>"Joaquim Duran" < XXXX@XXXXX.COM >wrote:
>>[...] Has somebody found this problem?
>
>Never heard of it before.
>
>>How to fix it?
>
>Try making the TPrinter object local so that when the function
>returns, the stack is unwound, thus effectively deleting the
>TPrinter object.
>
>~ JD
>