GetPrinters() fails

GetPrinters() fails

Postby StefanHaupt » Wed Dec 14, 2011 6: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: Select all  Expand view
#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

Postby StefanHaupt » Wed Dec 14, 2011 6: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
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Re: GetPrinters() fails

Postby wmormar » Wed Dec 14, 2011 7:08 pm

StefanHaupt,

Use aGetPrinters()

Rergards
William, Morales
Saludos

méxico.sureste
User avatar
wmormar
 
Posts: 1074
Joined: Fri Oct 07, 2005 10:41 pm
Location: México

Re: GetPrinters() fails

Postby StefanHaupt » Thu Dec 15, 2011 8: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
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Re: GetPrinters() fails

Postby wmormar » Thu Dec 15, 2011 8: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
User avatar
wmormar
 
Posts: 1074
Joined: Fri Oct 07, 2005 10:41 pm
Location: México

Re: GetPrinters() fails

Postby StefanHaupt » Thu Dec 15, 2011 9: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
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Re: GetPrinters() fails

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

Re: GetPrinters() fails

Postby StefanHaupt » Fri Dec 16, 2011 8: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
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Re: GetPrinters() fails

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

Re: GetPrinters() fails

Postby Otto » 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
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6330
Joined: Fri Oct 07, 2005 7:07 pm

Re: GetPrinters() fails

Postby StefanHaupt » Mon Dec 19, 2011 8: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 :D
kind regards
Stefan
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Re: GetPrinters() fails

Postby Antonio Linares » Mon Dec 19, 2011 9:32 am

Stefan,

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42085
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 97 guests