GetPrinters() fails

Post Reply
StefanHaupt
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

GetPrinters() fails

Post by StefanHaupt »

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: Select all

#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
StefanHaupt
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Re: GetPrinters() fails

Post by StefanHaupt »

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
User avatar
wmormar
Posts: 1050
Joined: Fri Oct 07, 2005 10:41 pm
Location: México
Contact:

Re: GetPrinters() fails

Post by wmormar »

StefanHaupt,

Use aGetPrinters()

Rergards
William, Morales
Saludos

méxico.sureste
StefanHaupt
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Re: GetPrinters() fails

Post by StefanHaupt »

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
User avatar
wmormar
Posts: 1050
Joined: Fri Oct 07, 2005 10:41 pm
Location: México
Contact:

Re: GetPrinters() fails

Post by wmormar »

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
StefanHaupt
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Re: GetPrinters() fails

Post by StefanHaupt »

William,

GetDefaultPrinter fails here with fwh 11.09

Only if I remove legacycp.obj from fivehc.lib it is working again
kind regards
Stefan
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: GetPrinters() fails

Post by Antonio Linares »

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
StefanHaupt
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Re: GetPrinters() fails

Post by StefanHaupt »

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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: GetPrinters() fails

Post by Antonio Linares »

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
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Re: GetPrinters() fails

Post by Otto »

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
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org

********************************************************************
StefanHaupt
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Re: GetPrinters() fails

Post by StefanHaupt »

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 :D
kind regards
Stefan
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: GetPrinters() fails

Post by Antonio Linares »

Stefan,

Yes, thats a right solution, thanks :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply