Printing to printer

Printing to printer

Postby Ugo » Thu Feb 26, 2009 10:45 pm

Dear friends,
I found a problem with a my storical application, after i update to FWH 8.11 version.
PrimoPDF is a printer installed on my system but if I run the sample, return:
"PrimoPDF is not ready!"
I don't understood why!
How to repair?
Many thanks in advance,
Code: Select all  Expand view  RUN
FUNCTION Main()

   LOCAL cPrinter := "PrimoPDF", oPrn

   PRINT oPrn NAME "Test fivewin" TO cPrinter PREVIEW  // MODAL

   IF Empty( oPrn:hDC )
      MsgStop( cPrinter + " is not ready!!" )
   ELSE
      MsgINfo( "Printing!" )
   ENDIF
   PAGE
   oPrn:CmSay(  10.0 , 15.0, "TEST" )
   ENDPAGE
   ENDPRINT
   RETURN Nil
Ciao, best regards,
Ugo
User avatar
Ugo
 
Posts: 283
Joined: Sat Oct 15, 2005 6:40 am
Location: Turin, Italy

Re: Printing to printer

Postby hua » Fri Feb 27, 2009 2:11 am

If I'm not mistaken, it's a bug in TPrinter class and it happens when someone use "to <cPrinter>" clause on XP. It's fixed in FWH 9.01. Under method new() of Tprinter class, just make it look like this:
Code: Select all  Expand view  RUN

      cPrinter := GetProfString( "windows", "device" , "" )
      WriteProfString( "windows", "device", cModel )
      SysRefresh()
      PrinterInit()
      ::hDC := GetPrintDefault( GetActiveWindow() )
      SysRefresh()
      WriteProfString( "windows", "device", cPrinter  )
      // PrinterInit()
      // DeleteDC( ::hDC )
      // ::hDC = PrinterDCfromName( cModel )      
 
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: Printing to printer

Postby Ugo » Fri Feb 27, 2009 2:50 pm

hua wrote:If I'm not mistaken, it's a bug in TPrinter class and it happens when someone use "to <cPrinter>" clause on XP. It's fixed in FWH 9.01. Under method new() of Tprinter class, just make it look like this:

Dear Hua,
you are not mistaken, now work well. :)

The bug is also on Vista.

Many thanks for your help.
Ciao, best regards,
Ugo
User avatar
Ugo
 
Posts: 283
Joined: Sat Oct 15, 2005 6:40 am
Location: Turin, Italy


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 57 guests