Skip to Content
0
Former Member
Jun 13, 2016 at 07:14 PM

PB app hangs when printer is disconnected

48 Views

Hi,

One of our application (PB 11.5.1 Classic - SQL Server 2008R2) must print tickets after certain actions.

If the printer assigned is disconnected/turned off etc and the app tries to print...the app hangs. 😔

Is there a way I can avoid this? Numerous times users have been turning printers off by accident, causing silly freezes...

The code

PrintSetPrinter(ls_printer_name)

ll_handle = PrintOpen(ls_printer_name)

If ll_handle = -1 Then

MessageBox('Failed to open printer',ls_printer_name,Exclamation!)

End If

If ll_handle > 0 Then

blah blah blah

...

PrintSend(ll_handle, ls_printout)

PrintClose(ll_handle)

End If

I guess the PrintOpen should have protected the app from hanging...

Any thoughts?

Thanx