FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour FWH 8.12 Printer problem
Posts: 130
Joined: Sat Oct 08, 2005 09:38 PM
FWH 8.12 Printer problem
Posted: Thu Jan 01, 2009 04:53 PM
After I have upgrade fivewin to 8.12
      aPrnAry:=aGetPrinters()
      cPrinter:=aPrnAry[2]
      PRINT oPrn DOC cDoc TO cPrinter

does not work because it cannot find the printer.

I have checked the printer.prg and I have realised that the lines below commented
      cPrinter := GetProfString( "windows", "device" , "" )
      WriteProfString( "windows", "device", cModel )
      SysRefresh()
      PrinterInit()
      ::hDC := GetPrintDefault( GetActiveWindow() )
      SysRefresh()
      WriteProfString( "windows", "device", cPrinter  )

instead of them the lines below added
      PrinterInit()
      DeleteDC( ::hDC )
      ::hDC = PrinterDCfromName( cModel )

But the print system cannot find the printer to print.

Regards,
Birol BETONCU
Birol Betoncu
birol.betoncu@gmail.com
Using Harbour, FWH 19.05, BCC7
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: FWH 8.12 Printer problem
Posted: Thu Jan 01, 2009 06:19 PM

Birol,

What Windows version are you using ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 130
Joined: Sat Oct 08, 2005 09:38 PM
Re: FWH 8.12 Printer problem
Posted: Thu Jan 01, 2009 07:11 PM

Antonio,
I am using Win XP SP3

Regards

Birol Betoncu
birol.betoncu@gmail.com
Using Harbour, FWH 19.05, BCC7
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: FWH 8.12 Printer problem
Posted: Fri Jan 02, 2009 12:47 PM

Works fine here with the same Windows version. Maybe a printer driver issue?

EMG

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: FWH 8.12 Printer problem
Posted: Fri Jan 02, 2009 01:30 PM

Birol,

Please try to replace the lines that you point in your first post with the commented ones, thanks

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 130
Joined: Sat Oct 08, 2005 09:38 PM
Re: FWH 8.12 Printer problem
Posted: Fri Jan 02, 2009 02:12 PM

Antonio,
It works fine after I removed the new lines and inserted the old ones.

Regards,
Birol Betoncu

Birol Betoncu
birol.betoncu@gmail.com
Using Harbour, FWH 19.05, BCC7
Posts: 130
Joined: Sat Oct 08, 2005 09:38 PM
Re: FWH 8.12 Printer problem
Posted: Fri Jan 02, 2009 03:13 PM
I have done a self contained examle.
Please try this. The program quits without showing the preview screen.
#include "FiveWin.ch"

function Main()
local oPrn, cPrinter, cDoc:='test', aPrnAry:=aGetPrinters()
   cPrinter:=aPrnAry[2]
   MsgInfo("Selected printer "+cPrinter)
//   PRINT oPrn DOC cDoc PREVIEW              // If I use this line it works fine
   PRINT oPrn DOC cDoc TO cPrinter PREVIEW    // This line does not work
      PAGE
         oPrn:Say( 20, 20, "This is a test" )
      ENDPAGE
   ENDPRINT
return nil


Regards,
Birol Betoncu
Birol Betoncu
birol.betoncu@gmail.com
Using Harbour, FWH 19.05, BCC7
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: FWH 8.12 Printer problem
Posted: Mon Jan 05, 2009 11:57 AM

Birol,

> MsgInfo("Selected printer "+cPrinter)

What is the name shown for cPrinter ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 946
Joined: Thu Oct 06, 2005 07:05 PM
Re: FWH 8.12 Printer problem
Posted: Mon Jan 05, 2009 02:32 PM

Antonio

Printing to a specified printer has changed in fwh versions

Back to fwh 8.08 , you needed to select the printer and model ,i mean the model is included after the name separated with a comma . This was working ok, i use it in my pos system

Fron fwh 8.10 this was not working anymore, only the printer name has to be set...

this is my printer select function , the commented line is what has to be used now

I am still using fwh 8.08

HTH

Richard

FUNCTION GETIMPRI(ADEVICES)
*----------------------------------------
LOCAl cAllEntries, cEntry, I, cName, cPrn, cPort, J
cAllEntries := STRTRAN( GetProfString( "Devices" ), Chr( 0 ), CRLF )
FOR I:= 1 TO MlCount( cAllEntries )
cName := MemoLine( cAllEntries,,I)
cEntry := GetProfString( "Devices",cName,"")
J := 2
WHILE ! EMPTY(cPort := StrToken(cEntry,J++,","))
// AADD(aDevices,TRIM(cName))
AADD(aDevices,TRIM(cName) + "," + CENTRY)
ENDDO
NEXT
RETURN aDevices

http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
Posts: 130
Joined: Sat Oct 08, 2005 09:38 PM
Re: FWH 8.12 Printer problem
Posted: Mon Jan 05, 2009 04:11 PM
MsgInfo returns the correct printer name i.e "HP LaserJet 5L"
I have tried the GETDEFAULTPRINTER() function as shown below. It does not work also.

#include "FiveWin.ch"

function Main()
local oPrn, cPrinter, cDoc:='test'
   cPrinter := GETDEFAULTPRINTER()
   MsgInfo(cPrinter)
   PRINT oPrn DOC cDoc TO cPrinter PREVIEW
      PAGE
         oPrn:Say( 20, 20, "This is a test" )
      ENDPAGE
   ENDPRINT
return nil

Regards,
Birol BETONCU
Birol Betoncu
birol.betoncu@gmail.com
Using Harbour, FWH 19.05, BCC7
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: FWH 8.12 Printer problem
Posted: Mon Jan 05, 2009 08:32 PM
Birol,

Your first example is working fine here on Vista Ultimate 32 and using a shared lan printer (Canon).

Tested with FWH 8.12.
#include "FiveWin.ch"

function Main()
local oPrn, cPrinter, cDoc:='test', aPrnAry:=aGetPrinters()
   cPrinter:=aPrnAry[2]
   MsgInfo("Selected printer "+cPrinter)
   PRINT oPrn DOC cDoc TO cPrinter PREVIEW    // Working fine with Vista 32
      PAGE
         oPrn:Say( 20, 20, "This is a test" )
      ENDPAGE
   ENDPRINT
return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: FWH 8.12 Printer problem
Posted: Mon Jan 05, 2009 08:35 PM

Dear Enrico,

Could you please test Birol's first example on Windows XP ? thanks

We only use Windows XP here from vmware (virtual). All our machines use Vista and some already testing Windows 7 pre-beta.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: FWH 8.12 Printer problem
Posted: Mon Jan 05, 2009 09:18 PM
It doesn't work. Please check this possible fix: in function PrintBegin() replace

   cDevice := aPrn[ nScan ] + "," + cText


with

   cDevice := aPrn[ nScan ]// + "," + cText


EMG
Posts: 363
Joined: Wed Feb 15, 2006 02:06 PM
Re: FWH 8.12 Printer problem
Posted: Thu Jan 15, 2009 03:01 PM
Enrico Maria Giordano wrote:It doesn't work. Please check this possible fix: in function PrintBegin() replace

   cDevice := aPrn[ nScan ] + "," + cText


with

   cDevice := aPrn[ nScan ]// + "," + cText


EMG


I'm having the same problem and can confirm that the above seems to fix the problem - i'm assuming this will be in as standard for the next release?
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: FWH 8.12 Printer problem
Posted: Thu Jan 15, 2009 03:19 PM

Pete,

yes, we have modifed it as Enrico suggested and it will be included in next FWH 9.01 :-)

Thanks,

regards, saludos

Antonio Linares
www.fivetechsoft.com