Board index » delphi » Selected Printer Is Not Valid

Selected Printer Is Not Valid

Hello All,

If I use TPrinterDialog to select my printer, and subsequently call
AssingPrn and Rewrite.  I get an exception when calling Rewrite stating that
the "Selected Printer Is Not Valid".

I ONLY see this problem on Win95. I works just fine on Win98/NT/2000.

Anyone know what the problem could be?

Thanks,
Chuck

 

Re:Selected Printer Is Not Valid


I have exactly same problem doing a TQuickRep.Print when papersize is
Custom!

Have not found solution, had to change papersize to A4 and then it worked...

Regards,
Stephan
 (Please reply to Stephan.van.In...@advalvas.be if you have solution!
Thankx)

Quote
Chuck Haron <aclha...@earthlink.net> wrote in message

news:96ekv6$k8a7@bornews.inprise.com...
Quote
> Hello All,

> If I use TPrinterDialog to select my printer, and subsequently call
> AssingPrn and Rewrite.  I get an exception when calling Rewrite stating
that
> the "Selected Printer Is Not Valid".

> I ONLY see this problem on Win95. I works just fine on Win98/NT/2000.

> Anyone know what the problem could be?

> Thanks,
> Chuck

Re:Selected Printer Is Not Valid


Quote
In article <96ekv6$k...@bornews.inprise.com>, Chuck Haron wrote:
> If I use TPrinterDialog to select my printer, and subsequently call
> AssingPrn and Rewrite.  I get an exception when calling Rewrite stating that
> the "Selected Printer Is Not Valid".
> I ONLY see this problem on Win95. I works just fine on Win98/NT/2000.
> Anyone know what the problem could be?

Does the system have a default printer defined?

Anyway, calling this little function before you do the AssignPrn may help.

 procedure ResetPrinter;
   var
     Device, Driver, Port: array[0..80] of Char;
     DevMode: THandle;
   begin
   Printer.GetPrinter(Device, Driver, Port, DevMode);
   Printer.SetPrinter(Device, Driver, Port, 0)
   end;

Peter Below (TeamB)  100113.1...@compuserve.com)
No e-mail responses, please, unless explicitly requested!
Note: I'm unable to visit the newsgroups every day at the moment,
so be patient if you don't get a reply immediately.

Other Threads