FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour GetPrinters() fails
Posts: 824
Joined: Thu Oct 13, 2005 07:39 AM
GetPrinters() fails
Posted: Wed Dec 14, 2011 06:17 PM
Antonio,

I noticed, that the function GetPrinters() defined in xHarbour is not working anymore with fwh 1109. It returns an undefined value.

This small sample shows the error.

Code (fw): Select all Collapse
#include "Fivewin.ch"

procedure Main ()

  LOCAL aPrn, cPrn

  aPrn := GetPrinters ()
  cPrn := GetDefaultPrinter ()

  ? Valtype (aPrn), Valtype (cPrn), cPrn

  RETURN


I found that these functions are replaced (?) in the file legacycp.c. But I don´t really understand, what happens in this file. I think, GetPrinters () is replaced with Win_PrinterList(), but this is one of the unresolved externals we had to define as dummy functions. What is this file for ?

Fact is, that it kills the functions GetPrinters() and GetDefaultPrinter() and others defined in xHarbour.

Antonio, could you please review this issue ? I´m using these function very often.
kind regards

Stefan
Posts: 824
Joined: Thu Oct 13, 2005 07:39 AM
Re: GetPrinters() fails
Posted: Wed Dec 14, 2011 06:30 PM

I just removed legacycp from the library and now it´s working fine again.

Is it ok to remove it or are there any side effects ?

kind regards

Stefan
Posts: 1076
Joined: Fri Oct 07, 2005 10:41 PM
Re: GetPrinters() fails
Posted: Wed Dec 14, 2011 07:08 PM

StefanHaupt,

Use aGetPrinters()

Rergards

William, Morales

Saludos



méxico.sureste
Posts: 824
Joined: Thu Oct 13, 2005 07:39 AM
Re: GetPrinters() fails
Posted: Thu Dec 15, 2011 08:04 AM

William,

yes, that would a possibility, but all other function, like GetPrinDefault(), PrinterExist(),... also don´t work.

And I don´t understand the reason of these replacements.

kind regards

Stefan
Posts: 1076
Joined: Fri Oct 07, 2005 10:41 PM
Re: GetPrinters() fails
Posted: Thu Dec 15, 2011 08:20 AM

StefanHaupt,

this is xHarbour

PROCEDURE Main()
LOCAL cPrinter := GetDefaultPrinter()
? cPrinter
RETURN

PROCEDURE Main()
? PrinterExists( "HP LaserJet 1200 Series PCL" ) // result: .T.
? PrinterExists( "HP LASERJET 1200 SERIES PCL" ) // result: .F.
RETURN

William, Morales

Saludos



méxico.sureste
Posts: 824
Joined: Thu Oct 13, 2005 07:39 AM
Re: GetPrinters() fails
Posted: Thu Dec 15, 2011 09:07 AM

William,

GetDefaultPrinter fails here with fwh 11.09

Only if I remove legacycp.obj from fivehc.lib it is working again

kind regards

Stefan
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: GetPrinters() fails
Posted: Thu Dec 15, 2011 10:45 AM

Stefan,

Please modify legacycp.c this way just leaving these functions:

HB_FUNC_EXTERN( WIN_PRINTEREXISTS ) ; HB_FUNC( PRINTEREXISTS ) { HB_FUNC_EXEC( WIN_PRINTEREXISTS ); }
HB_FUNC_EXTERN( WIN_PRINTERSTATUS ) ; HB_FUNC( XISPRINTER ) { HB_FUNC_EXEC( WIN_PRINTERSTATUS ); }
HB_FUNC_EXTERN( WIN_PRINTERPORTTONAME ) ; HB_FUNC( PRINTERPORTTONAME ) { HB_FUNC_EXEC( WIN_PRINTERPORTTONAME ); }
HB_FUNC_EXTERN( WIN_PRINTFILERAW ) ; HB_FUNC( PRINTFILERAW ) { HB_FUNC_EXEC( WIN_PRINTFILERAW ); }

thanks,

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 824
Joined: Thu Oct 13, 2005 07:39 AM
Re: GetPrinters() fails
Posted: Fri Dec 16, 2011 08:53 AM

Antonio,

ok, that solves the problem with GetPrinters() and GetdefaultPrinter(), but the other functions are still unavailable.

What was your intention, to replace these functions ?

kind regards

Stefan
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: GetPrinters() fails
Posted: Fri Dec 16, 2011 10:58 AM

Stefan,

We had to use several files from Harbour to keep backwards compatibility with OLE support, but in fact we dont need the functions from that file so we are going to try to remove it entirely

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: GetPrinters() fails
Posted: Fri Dec 16, 2011 11:14 AM

Hello Antonio,

I get the same error.
Best regards,
Otto

Error: Unresolved external '_HB_FUN_WIN_PRINTEREXISTS' referenced from C:\FWH\LIB\FIVEHC.LIB|LEGACYCP
Error: Unresolved external '_HB_FUN_WIN_PRINTERGETDEFAULT' referenced from C:\FWH\LIB\FIVEHC.LIB|LEGACYCP
Error: Unresolved external '_HB_FUN_WIN_PRINTERSTATUS' referenced from C:\FWH\LIB\FIVEHC.LIB|LEGACYCP
Error: Unresolved external '_HB_FUN_WIN_PRINTERPORTTONAME' referenced from C:\FWH\LIB\FIVEHC.LIB|LEGACYCP
Error: Unresolved external '_HB_FUN_WIN_PRINTFILERAW' referenced from C:\FWH\LIB\FIVEHC.LIB|LEGACYCP
Error: Unresolved external '_HB_FUN_WIN_PRINTERLIST' referenced from C:\FWH\LIB\FIVEHC.LIB|LEGACYCP
Error: Unresolved external '_HB_FUN_WIN_PRINTERSETDEFAULT' referenced from C:\FWH\LIB\FIVEHC.LIB|LEGACYCP

Posts: 824
Joined: Thu Oct 13, 2005 07:39 AM
Re: GetPrinters() fails
Posted: Mon Dec 19, 2011 08:47 AM
Antonio Linares wrote:
We had to use several files from Harbour to keep backwards compatibility with OLE support, but in fact we dont need the functions from that file so we are going to try to remove it entirely


Ok, thanks for your explanation. In the meantime I removed this obj from the lib and everything is working fine now :-)
kind regards

Stefan
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: GetPrinters() fails
Posted: Mon Dec 19, 2011 09:32 AM

Stefan,

Yes, thats a right solution, thanks :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion