KillGabio
1st February 2012, 17:48
Hi guys, im facing what i think is going to be my biggest problem. I need to stablish a communication with a Fiscal Printer. For that i have the following files downloaded from the official website of the printer:
winfis32.bas
winfis32.dll
Winfis.h
winfis.lib
To my surprise the header file included throws some extrange error when trying to compile: the sentence FAR PASCAL is not recognised. So i looked what was this and as I read is an old convention to especify parameters and size of pointers. (Precise and concise information here: http://stackoverflow.com/questions/2774171/what-is-far-pascal).
My question is: do i need to delete that part of the code?
The drivers also include a way to communicate via OCX but as shown in the examples of the drivers documentation is recommended to use them when programming with Visual Basic. Should i change and work with OCX?
here is the code of the header:
#ifndef _WINFIS_H
#define _WINFIS_H
#ifdef __cplusplus
extern "C" {
#endif
#define VERSION 427
#ifdef WIN32
#define _export
typedef void (*PFV)(int Reason, int Port);
typedef void (__stdcall *PFVSTDCALL)(int Reason, int Port);
#endif
int FAR PASCAL _export OpenComFiscal (int Com, int Mode);
int FAR PASCAL _export OpenTcpFiscal (char *HostName, int Socket, long TimeoutMilisecs, int Mode);
#ifdef WIN32
int FAR PASCAL _export ReOpenComFiscal (int Com);
#endif
void FAR PASCAL _export CloseComFiscal (int Handler);
int FAR PASCAL _export MandaPaqueteFiscal (int Handler, char *Buffer);
int FAR PASCAL _export UltimaRespuesta (int Handler, char *Buffer);
int FAR PASCAL _export UltimoStatus (int Handler, short *FiscalStatus,
short *PrinterStatus);
int FAR PASCAL _export VersionDLLFiscal (void);
int FAR PASCAL _export InitFiscal (int Handler);
void FAR PASCAL _export BusyWaitingMode (int Mode);
int FAR PASCAL _export CambiarVelocidad(int Handler, long NewSpeed);
void FAR PASCAL _export ProtocolMode(int Mode);
long FAR PASCAL _export SearchPrn (int Handler);
int FAR PASCAL _export ObtenerNumeroDePaquetes (int Handler,
int *Enviado, int *Recibido,
int *CmdRecibido);
#ifdef WIN32
void FAR PASCAL _export SetKeepAliveHandler(PFV Handler);
void FAR PASCAL _export SetKeepAliveHandlerStdCall(PFVSTDCALL Handler);
void FAR PASCAL _export Abort(int Handler);
#endif
int FAR PASCAL _export SetCmdRetries (int Retries);
int FAR PASCAL _export SetSndRetries (int Retries);
int FAR PASCAL _export SetRcvRetries (int Retries);
int FAR PASCAL _export SetModoEpson (int Modo);
#define SIZEANSWER 1024
#define MODE_ASCII 0
#define MODE_ANSI 1
#define BUSYWAITING_OFF 0
#define BUSYWAITING_ON 1
#define OLD_PROTOCOL 0
#define NEW_PROTOCOL 1
#ifdef __cplusplus
}
#endif
#endif // _WINFIS_H
winfis32.bas
winfis32.dll
Winfis.h
winfis.lib
To my surprise the header file included throws some extrange error when trying to compile: the sentence FAR PASCAL is not recognised. So i looked what was this and as I read is an old convention to especify parameters and size of pointers. (Precise and concise information here: http://stackoverflow.com/questions/2774171/what-is-far-pascal).
My question is: do i need to delete that part of the code?
The drivers also include a way to communicate via OCX but as shown in the examples of the drivers documentation is recommended to use them when programming with Visual Basic. Should i change and work with OCX?
here is the code of the header:
#ifndef _WINFIS_H
#define _WINFIS_H
#ifdef __cplusplus
extern "C" {
#endif
#define VERSION 427
#ifdef WIN32
#define _export
typedef void (*PFV)(int Reason, int Port);
typedef void (__stdcall *PFVSTDCALL)(int Reason, int Port);
#endif
int FAR PASCAL _export OpenComFiscal (int Com, int Mode);
int FAR PASCAL _export OpenTcpFiscal (char *HostName, int Socket, long TimeoutMilisecs, int Mode);
#ifdef WIN32
int FAR PASCAL _export ReOpenComFiscal (int Com);
#endif
void FAR PASCAL _export CloseComFiscal (int Handler);
int FAR PASCAL _export MandaPaqueteFiscal (int Handler, char *Buffer);
int FAR PASCAL _export UltimaRespuesta (int Handler, char *Buffer);
int FAR PASCAL _export UltimoStatus (int Handler, short *FiscalStatus,
short *PrinterStatus);
int FAR PASCAL _export VersionDLLFiscal (void);
int FAR PASCAL _export InitFiscal (int Handler);
void FAR PASCAL _export BusyWaitingMode (int Mode);
int FAR PASCAL _export CambiarVelocidad(int Handler, long NewSpeed);
void FAR PASCAL _export ProtocolMode(int Mode);
long FAR PASCAL _export SearchPrn (int Handler);
int FAR PASCAL _export ObtenerNumeroDePaquetes (int Handler,
int *Enviado, int *Recibido,
int *CmdRecibido);
#ifdef WIN32
void FAR PASCAL _export SetKeepAliveHandler(PFV Handler);
void FAR PASCAL _export SetKeepAliveHandlerStdCall(PFVSTDCALL Handler);
void FAR PASCAL _export Abort(int Handler);
#endif
int FAR PASCAL _export SetCmdRetries (int Retries);
int FAR PASCAL _export SetSndRetries (int Retries);
int FAR PASCAL _export SetRcvRetries (int Retries);
int FAR PASCAL _export SetModoEpson (int Modo);
#define SIZEANSWER 1024
#define MODE_ASCII 0
#define MODE_ANSI 1
#define BUSYWAITING_OFF 0
#define BUSYWAITING_ON 1
#define OLD_PROTOCOL 0
#define NEW_PROTOCOL 1
#ifdef __cplusplus
}
#endif
#endif // _WINFIS_H