Page 1 of 1
InPortByte() function missing in FWH 2.7 FIVEHC.LIB
Posted: Sun Jul 09, 2006 2:29 am
by RAMESHBABU
I was trying to re-compile all my FWH 2.5 programs with FWH 2.7 and I am getting the following error.
Unresolved external "_HB_FUN_INPORTBYTE".
When I checked, I found that "InPortByte()" function and other funcitons of inout.c are missing in FIVEHC.LIB.
What to do ?
- Ramesh Babu P
Posted: Sun Jul 09, 2006 2:45 pm
by RAMESHBABU
Hi Antonio
I found some posting from you regarding this problem in FWH spanish forum. But I can't understand what you said there.
Please help me to resolve these unresolved externals InPortByte() and ExportByte()
- Ramesh Babu P
Posted: Sun Jul 09, 2006 4:23 pm
by Antonio Linares
Ramesh,
InPortByte() and OutPortByte() are not available in 32 bits. Win32 does not allow them.
What do you need to do with them ?
Posted: Mon Jul 10, 2006 1:37 am
by RAMESHBABU
Hi Antonio
Thank you for your reply.
These functions are used in TDosPrn() to check the status of the printer.
*******************************************************************************
*** METHOD PrinterStatus() CLASS TDosPrn to Find out the Printer Status ***
*******************************************************************************
METHOD PrinterStatus() CLASS TDosPrn
Local nStatus
If ::nLPTBase > 0
nStatus := InPortByte( ::nLPTBase + 1 )
::lPrnError := ! lIsBit( nStatus, 4 )
::lPrnSelect := lIsBit( nStatus, 5 )
::lPaperOut := lIsBit( nStatus, 6 )
::lDataAck := ! lIsBit( nStatus, 7 )
::lPrnBusy := ! lIsBit( nStatus, 8 )
Endif
Return Self
*********
Is there any way to implement the above method.
Regards
- Ramesh Babu P
Posted: Mon Jul 10, 2006 7:09 am
by Antonio Linares
Posted: Mon Jul 10, 2006 9:02 am
by RAMESHBABU
Hello Mr.Antonio
I have gone through the article and I do not know how to impliment the
sample code shown in the article.
Regards
- Ramesh Babu P
Posted: Tue Jul 11, 2006 5:46 pm
by Antonio Linares
Ramesh,
We are going to adapt it asap.
Posted: Sun Jul 16, 2006 5:44 pm
by Antonio Linares
Ramesh,
Please try this sample and let us know what values you get. Please replace "LPT1" with the value that you use with Class TDosPrn:
Code: Select all
function Main()
local nHandle := 0
MsgInfo( OpenPrinter( "LPT1", @nHandle ) )
MsgInfo( nHandle )
MsgInfo( ClosePrinter( nHandle ) )
return nil
#pragma BEGINDUMP
#include <windows.h>
#include <hbapi.h>
HB_FUNC( OPENPRINTER )
{
HANDLE hPrinter;
hb_retl( OpenPrinter( hb_parc( 1 ), &hPrinter, NULL ) );
hb_stornl( ( unsigned long ) hPrinter, 2 );
}
HB_FUNC( CLOSEPRINTER )
{
hb_retl( ClosePrinter( ( HANDLE ) hb_parnl( 1 ) ) );
}
#pragma ENDDUMP
Posted: Wed Jul 19, 2006 4:56 pm
by Antonio Linares
Ramesh,
Please try this code:
Code: Select all
CLIPPER PRNSTATUS( PARAMS ) // cPrinter or cPrinterServer --> nStatus
{
HANDLE hPrinter = NULL;
DWORD cBytesNeeded = 0, cBytesUsed = 0, status = 0;
PRINTER_INFO_2 * pPrinterInfo = NULL;
if( OpenPrinter( _parc( 1 ), &hPrinter, NULL ) )
{
GetPrinter( hPrinter, 2, NULL, 0, &cBytesNeeded );
pPrinterInfo = ( PRINTER_INFO_2 * ) _xgrab( cBytesNeeded );
GetPrinter( hPrinter, 2, ( unsigned char * ) pPrinterInfo, cBytesNeeded, &cBytesUsed );
_retnl( pPrinterInfo->Status );
_xfree( pPrinterInfo );
ClosePrinter( hPrinter );
}
else
_retnl( PRINTER_STATUS_NOT_AVAILABLE );
}
Este es un ejemplo de uso:
Code: Select all
#define PRINTER_STATUS_OK 0
#define PRINTER_STATUS_PAUSED 1
#define PRINTER_STATUS_ERROR 2
#define PRINTER_STATUS_PENDING_DELETION 4
#define PRINTER_STATUS_PAPER_JAM 8
#define PRINTER_STATUS_PAPER_OUT 16
#define PRINTER_STATUS_MANUAL_FEED 32
#define PRINTER_STATUS_PAPER_PROBLEM 64
#define PRINTER_STATUS_OFFLINE 128
#define PRINTER_STATUS_IO_ACTIVE 256
#define PRINTER_STATUS_BUSY 512
#define PRINTER_STATUS_PRINTING 1024
#define PRINTER_STATUS_OUTPUT_BIN_FULL 2048
#define PRINTER_STATUS_NOT_AVAILABLE 4096
#define PRINTER_STATUS_WAITING 8192
#define PRINTER_STATUS_PROCESSING 16384
#define PRINTER_STATUS_INITIALIZING 32768
#define PRINTER_STATUS_WARMING_UP 65536
#define PRINTER_STATUS_TONER_LOW 131072
#define PRINTER_STATUS_NO_TONER 262144
#define PRINTER_STATUS_PAGE_PUNT 524288
#define PRINTER_STATUS_USER_INTERVENTION 1048576
#define PRINTER_STATUS_OUT_OF_MEMORY 2097152
#define PRINTER_STATUS_DOOR_OPEN 4194304
#define PRINTER_STATUS_SERVER_UNKNOWN 8388608
#define PRINTER_STATUS_POWER_SAVE 16777216
function Main()
local nStatus := PrnStatus( "LPT1:" )
MsgInfo( nStatus )
return nil
http://hyperupload.com/download/01b93ba ... C.obj.html
Posted: Thu Jul 20, 2006 4:57 pm
by RAMESHBABU
Hello Mr.Antonio
Thank you for your reply.
I have tested the above code. I felt that this code is useful only when
we use windows printers but not for dos printers.
I have replaced the code in TDosPrn and I found that even though the
printer is not switched off, PrnStatus("LPT1:") is always returning 0.
It might be due to windows printing is routed through the spooler and we
always get the PrnStatus("LPT1::") as 0 unlike Clipper's ISPRINTER().
But the code you have given is very useful when we use Windows printers.
I have gone through so many articles in our forum and on the net. But
I did not find any replacement function/method or at least a workaround
way to replace Clipper's ISPRINTER() functionality for Windows Printers.
I use only TDosPrn() to print outputs in most my applications. Most of my
application users have used my clipper applications earlier and now using
windows application. They are normally not interested to know our
technical issues. They always take it granted that every thing is possible
to do in computers.
If you can suggest me any way out to test whether the printer is in it ON
state or OFF state before I issue a print command, I will be very happy.
Regards,
- Ramesh Babu P