Objectmix
Tags Register Mark Forums Read

BMC international fiscal printer : xharbour

This is a discussion on BMC international fiscal printer within the xharbour forums in Programming Languages category; Hi, I have a BMC fiscal termal printer, that work with a fpctrl.dll for controlling the printer. The visual basic code for calling the printer functions are: '=============================================== ' Standard Module File for Visual Basic '=============================================== '////////////////////////////////////////////////////////// '// Fiscal Printer DLL 'FPCTRL.dll' library definitions '////////////////////////////////////////////////////////// Declare Function OpenFpctrl Lib "FPCTRL.DLL" (ByVal lpPortName As String) As Long Declare Function CloseFpctrl Lib "FPCTRL.DLL" () As Long Declare Function CheckFprinter Lib "FPCTRL.DLL" () As Long Declare Function ReadFpStatus Lib "FPCTRL.DLL" (status As Long, error As Long) As Long Declare Function SendCmd Lib "FPCTRL.DLL" (status As Long, error As Long, ByVal cmd As String) ...


Object Mix > Programming Languages > xharbour > BMC international fiscal printer

Reply

 

LinkBack Thread Tools
  #1  
Old 06-01-2007, 02:14 PM
Junior Member
 
Join Date: Nov 2009
Posts: 0
Application Development is on a distinguished road
Default BMC international fiscal printer

Hi,

I have a BMC fiscal termal printer, that work with a fpctrl.dll for
controlling the printer.

The visual basic code for calling the printer functions are:

'===============================================
' Standard Module File for Visual Basic
'===============================================


'//////////////////////////////////////////////////////////
'// Fiscal Printer DLL 'FPCTRL.dll' library definitions
'//////////////////////////////////////////////////////////
Declare Function OpenFpctrl Lib "FPCTRL.DLL" (ByVal lpPortName As
String) As Long
Declare Function CloseFpctrl Lib "FPCTRL.DLL" () As Long
Declare Function CheckFprinter Lib "FPCTRL.DLL" () As Long
Declare Function ReadFpStatus Lib "FPCTRL.DLL" (status As Long, error As
Long) As Long
Declare Function SendCmd Lib "FPCTRL.DLL" (status As Long, error As
Long, ByVal cmd As String) As Long
Declare Function SendNCmd Lib "FPCTRL.DLL" (status As Long, error As
Long, ByVal buffer As String) As Long
Declare Function SendFileCmd Lib "FPCTRL.DLL" (status As Long, error As
Long, ByVal file As String) As Long
Declare Function UploadReportCmd Lib "FPCTRL.DLL" (status As Long, error
As Long, ByVal cmd As String, ByVal file As String) As Long





I had declared the functions in xHarbour:

#include "hbdll.ch"

IMPORT LONG OpenFpctrl( LPCTSTR cBFI_lPortName ) ;
FROM fpctrl.dll

IMPORT LONG CloseFpctrl() FROM fpctrl.dll

IMPORT LONG CheckFprinter() FROM fpctrl.dll

IMPORT LONG ReadFpStatus( LONG nBFI_Status, LONG cBFI_Error ) ;
FROM fpctrl.dll

IMPORT LONG SendCmd( LONG nBFI_Status, LONG cBFI_Error, ;
LPCSTR cBFI_Command ) FROM fpctrl.dll

IMPORT LONG SendNCmd( LONG nBFI_Status, LONG cBFI_Command, ;
LPCSTR cBFI_Buffer ) FROM fpctrl.dll


and an call example is:

nStatus := 0
nError := 0
MsgInfo( "Log in Clerck 1" )
BFI_RETORNO := SendCmd( @nStatus, @nError, "o0100001" )
IF BFI_RETORNO == 0
MsgStop( "Error en Log in Clerck 1")
ENDIF
nStatus := 0
nError := 0
BFI_RETORNO := SendCmd( @nStatus, @nError, "500001" )
IF BFI_RETORNO == 0
MsgStop( "Error en Log in Clerck 2")
ENDIF


but unfortunately is not working.

If somebody can give an idea will be appreciate.

Regards,
Marcelo Anelli
  #2  
Old 06-01-2007, 03:37 PM
Junior Member
 
Join Date: Nov 2009
Posts: 0
Application Development is on a distinguished road
Default Re: BMC international fiscal printer

i dont't kwnow 'FPCTRL.dll'
Have you a working sample , asoin antother languages?




  #3  
Old 06-01-2007, 04:58 PM
Junior Member
 
Join Date: Nov 2009
Posts: 0
Application Development is on a distinguished road
Default Re: BMC international fiscal printer

Hi Massimo,

the working example from where I use the sample for the
import command:

'===============================================
' Standard Module File for Visual Basic
'===============================================


'//////////////////////////////////////////////////////////
'// Fiscal Printer DLL 'FPCTRL.dll' library definitions
'//////////////////////////////////////////////////////////
Declare Function OpenFpctrl Lib "FPCTRL.DLL" (ByVal lpPortName As
String) As Long
Declare Function CloseFpctrl Lib "FPCTRL.DLL" () As Long
Declare Function CheckFprinter Lib "FPCTRL.DLL" () As Long
Declare Function ReadFpStatus Lib "FPCTRL.DLL" (status As Long, error As
Long) As Long
Declare Function SendCmd Lib "FPCTRL.DLL" (status As Long, error As
Long, ByVal cmd As String) As Long
Declare Function SendNCmd Lib "FPCTRL.DLL" (status As Long, error As
Long, ByVal buffer As String) As Long
Declare Function SendFileCmd Lib "FPCTRL.DLL" (status As Long, error As
Long, ByVal file As String) As Long
Declare Function UploadReportCmd Lib "FPCTRL.DLL" (status As Long, error
As Long, ByVal cmd As String, ByVal file As String) As Long

'//////////////////////////////////////////////////////////
' Receive Status Definitions
'//////////////////////////////////////////////////////////
'//status
Public Const FPCTL_NON_STATUS = &H0
Public Const FPCTL_NON_FISCAL_IN_IDLE = &H1
Public Const FPCTL_NON_FISCAL_IN_TRANSACTION = &H2
Public Const FPCTL_NON_FISCAL_NON_TRANSACTION = &H3
Public Const FPCTL_FISCAL_IN_IDLE = &H4
Public Const FPCTL_FISCAL_IN_TRANSACTION = &H5
Public Const FPCTL_FISCAL_NON_TRANSACTION = &H6
Public Const FPCTL_FISCAL_MEMORY_NEAR_FULL_IN_TRANSACTION = &H7
Public Const FPCTL_FISCAL_MEMORY_NEAR_FULL_NON_TRANSACTION = &H8
Public Const FPCTL_FISCAL_MEMORY_NEAR_FULL_IN_IDLE = &H9
Public Const FPCTL_FISCAL_MEMORY_FULL_IN_TRANSACTION = &HA
Public Const FPCTL_FISCAL_MEMORY_FULL_IN_NON_TRANSACTION = &HB
Public Const FPCTL_FISCAL_MEMORY_FULL_IN_IDLE = &HC
Public Const FPCTL_SENDNCMD_SUCCESS = &H0

'// error
Public Const FPCTL_ERROR_NO_ERROR = &H0
Public Const FPCTL_ERROR_PAPER_END = &H1
Public Const FPCTL_ERROR_PRINTER_MECHA_ERROR = &H2
Public Const FPCTL_ERROR_PAPER_END_MECHA_ERROR = &H3
Public Const FPCTL_ERROR_COMMAND_INVALID_VAL = &H50
Public Const FPCTL_ERROR_COMMAND_INVALID_TAX = &H54
Public Const FPCTL_ERROR_NOT_ASSIGNED_CLERK = &H58
Public Const FPCTL_ERROR_INVALID_COMMAND = &H5C
Public Const FPCTL_ERROR_FISCAL_ERROR = &H60
Public Const FPCTL_ERROR_FISCAL_MEMORY_ERROR = &H64
Public Const FPCTL_ERROR_FISCAL_MEMORY_FULL = &H6C

Public Const FPCTL_ERROR_BUFFER_FULL = &H70
Public Const FPCTL_ERROR_ANSWERED_NAK = &H80
Public Const FPCTL_ERROR_NOT_ANSWERED = &H89
Public Const FPCTL_ERROR_UNKNOWN_ANSWERED = &H90
Public Const FPCTL_ERROR_COMM_API = &H91
Public Const FPCTL_ERROR_FILE_OPEN = &H99



'===============================================
' Form Module of "FPTEST" for Visual Basic
'===============================================

Private Sub PortOpen_Click()
'///////////////////////////////////////////////////////
' Sample of COM# Port Open
'///////////////////////////////////////////////////////
Dim bRet As Boolean

ListOut ("**Open COM PORT**")
bRet = OpenFpctrl("COM1")

msg = "OpenFpctrl = " + boolCheck(bRet)
ListOut (msg)
If bRet = False Then
GoTo EndSub
End If

EndSub:

End Sub
Private Sub PortClose_Click()
'///////////////////////////////////////////////////////
' Sample of COM# Port Close
'///////////////////////////////////////////////////////
Dim bRet As Boolean

ListOut ("**Close COM Port**")
bRet = CloseFpctrl()

msg = "CloseFpctrl = " + boolCheck(bRet)
ListOut (msg)

End Sub
Private Sub Cancel_Click()
'////////////////////////////////////////////////////
' Sample of Transaction Cancel command "7"
'////////////////////////////////////////////////////
Dim cmd As String
Dim msg As String
Dim bRet As Boolean
Dim status As Long
Dim error As Long
ListOut ("**All Transaction Cancel**")
cmd = "7"
bRet = SendCmd(status, error, cmd)
msg = "SendCmd = " + boolCheck(bRet) + " status = " + Hex$(status)
+ " error = " + Hex$(error)
ListOut (msg)

End Sub


Private Sub Non_Fiscal_Click()
'///////////////////////////////////////////////////////
' Sample of Non_Fiscal Document issuing command "8"
'///////////////////////////////////////////////////////
Dim cmd As String
Dim msg As String
Dim bRet As Boolean
Dim status As Long
Dim error As Long
ListOut ("**Non-Fiscal Document issuing**")
Buf = ""
' //
----+----1----+----2----+----3----+----4----+----5----+----6----+----7
Buf = Buf + "80This is a sample of N.Fiscal 1" +
Chr$(13) + Chr$(10)
Buf = Buf + "80Document. You can issue 1" +
Chr$(13) + Chr$(10)
Buf = Buf + "80some original documents as 1" +
Chr$(13) + Chr$(10)
Buf = Buf + "80non fiscal by using texit 1" +
Chr$(13) + Chr$(10)
Buf = Buf + "81printing command. 1" +
Chr$(13) + Chr$(10)
lRet = SendNCmd(status, error, Buf)
msg = "SendNCmd = " + Str$(lRet) + " status = " + Hex$(status) + "
error = " + Hex$(error)
ListOut (msg)

End Sub

Private Sub Restart_Click()
'///////////////////////////////////////////////////////
' Sample of Print Re-Start command "e"
'///////////////////////////////////////////////////////
Dim cmd As String
Dim msg As String
Dim bRet As Boolean
Dim status As Long
Dim error As Long
ListOut ("**Print Re-Start Command**")
cmd = "e"
bRet = SendCmd(status, error, cmd)
msg = "SendCmd = " + boolCheck(bRet) + " status = " + Hex$(status)
+ " error = " + Hex$(error)
ListOut (msg)

End Sub

Private Sub Submit_File_Command_Click()
'///////////////////////////////////////////////////////
' Sample of Excuting command file
'///////////////////////////////////////////////////////
Dim bRet As Boolean
Dim lRet As Long
Dim status As Long
Dim error As Long
Dim cmd As String
Dim msg As String
Dim Buf As String
Dim File_Path As String
Dim FName As String


ListOut ("**File Command Submitting**")
File_Path = File1.Path
If Right$(File_Path, 1) = "\" Then File_Path = Left$(File_Path, 2)
FName = File_Path & "\" & File1.filename
lRet = SendFileCmd(status, error, FName) 'Send command file
msg = "SendFileCmd = " + Str$(lRet) + " status = " + Hex$(status) +
" error = " + Hex$(error)
ListOut (msg)

End Sub

Private Sub Time_Set_Click()
'///////////////////////////////////////////////////////
' Sample of Time Setting Command "PF"
'///////////////////////////////////////////////////////

Dim bRet As Boolean
Dim status As Long
Dim error As Long
Dim cmd As String

cmd = "PF" & Left$(Text1.Text, 6)
Text1.Text = "" ' Clear Text Box
ListOut (cmd)
ListOut ("**Time Programming**")
bRet = SendCmd(status, error, cmd)
msg = "SendCmd = " + boolCheck(bRet) + " status = " + Hex$(status)
+ " error = " + Hex$(error)
ListOut (msg)


End Sub

Private Sub Date_Set_Click()
'///////////////////////////////////////////////////////
' Sample of Date Set Command "PG"
'///////////////////////////////////////////////////////
Dim bRet As Boolean
Dim status As Long
Dim error As Long
Dim cmd As String

cmd = "PG" & Left$(Text1.Text, 6)
Text1.Text = "" ' Clear Text Box
ListOut (cmd)
ListOut ("**Date Programming**")
bRet = SendCmd(status, error, cmd)
msg = "SendCmd = " + boolCheck(bRet) + " status = " + Hex$(status)
+ " error = " + Hex$(error)
ListOut (msg)


End Sub

Private Sub CMD_Open_Click()
'///////////////////////////////////////////////////
' Sample of F.P. Open "o" & Log On Command "5"
'///////////////////////////////////////////////////
Dim bRet As Boolean
Dim status As Long
Dim error As Long
Dim cmd As String

cmd = "o0100001" 'Open Clerk # 1
ListOut ("**Open Fiscal Printer**")
bRet = SendCmd(status, error, cmd)
msg = "SendCmd = " + boolCheck(bRet) + " status = " + Hex$(status)
+ " error = " + Hex$(error)
ListOut (msg)
cmd = "500001" 'Clerk Log on # 1
ListOut ("**Clerk #1 Log On**")
bRet = SendCmd(status, error, cmd)
msg = "SendCmd = " + boolCheck(bRet) + " status = " + Hex$(status)
+ " error = " + Hex$(error)
ListOut (msg)

End Sub
Private Sub CMD_Close_Click()
'///////////////////////////////////////////////////
' Sample of F.P. Close "zz"
'///////////////////////////////////////////////////

Dim bRet As Boolean
Dim status As Long
Dim error As Long
Dim cmd As String

cmd = "zz"
ListOut ("**Close Fiscal Printer**")
bRet = SendCmd(status, error, cmd)
msg = "SendCmd = " + boolCheck(bRet) + " status = " + Hex$(status)
+ " error = " + Hex$(error)
ListOut (msg)

End Sub

Private Sub Cleak_Click()
'////////////////////////////////////////////
' Sample of LOG ON CLERK Command "5"
'////////////////////////////////////////////
Dim cmd As String
Dim msg As String
Dim bRet As Boolean
Dim status As Long
Dim error As Long
ListOut ("**Log On Clerk**")
cmd = "500001"
bRet = SendCmd(status, error, cmd)
msg = "SendCmd = " + boolCheck(bRet) + " status = " + Hex$(status)
+ " error = " + Hex$(error)
ListOut (msg)

End Sub

Private Sub SomeItem_Click()
'///////////////////////////////////////////////
' Sample of n Item Transaction Command $20-$25
'///////////////////////////////////////////////

Dim cmd As String
Dim msg As String
Dim bRet As Boolean
Dim status As Long
Dim error As Long
ListOut ("**In Item Transaction...**")
Buf = ""
' //
----+----1----+----2----+----3----+----4----+----5----+----6----+----7
Buf = Buf + " 0000100000001000000000000ORANGE JUICE
" + Chr$(13) + Chr$(10)
Buf = Buf + " 0000100000002500000000000COCA COLA
" + Chr$(13) + Chr$(10)
Buf = Buf + " 0000100000003500000000000JAPANESE BEER
" + Chr$(13) + Chr$(10)
Buf = Buf + " 0000100000002600000000000NEWYORK STEAK
" + Chr$(13) + Chr$(10)
Buf = Buf + " 0000100000002700000000000COOKTAIL
" + Chr$(13) + Chr$(10)
Buf = Buf + " 0000100000001800000000000ICE COFFEE
" + Chr$(13) + Chr$(10)
Buf = Buf + " 0000100000001900000000000ICE TEA
" + Chr$(13) + Chr$(10)
lRet = SendNCmd(status, error, Buf)
msg = "SendNCmd = " + Str$(lRet) + " status = " + Hex$(status) + "
error = " + Hex$(error)
ListOut (msg)

End Sub

Private Sub Total_Click()
'////////////////////////////////////////////
' Sample of Media Closing Command "1"
'////////////////////////////////////////////
Dim cmd As String
Dim msg As String
Dim bRet As Boolean
Dim status As Long
Dim error As Long

ListOut ("**Receipt Issue(Closing)**")
cmd = "101" 'CASH Closing
bRet = SendCmd(status, error, cmd)
msg = "SendCmd = " + boolCheck(bRet) + " status = " + Hex$(status)
+ " error = " + Hex$(error)
ListOut (msg)
End Sub


Private Sub ReadStatus_Click()
'//////////////////////////////////////////////
'// Sample of Status Read
'/////////////////////////////////////////////
Dim bRet As Boolean
Dim status As Long
Dim error As Long

bRet = ReadFpStatus(status, error)
msg = "ReadFpStatus = " + boolCheck(bRet) + " status = " + Hex$(status)
+ " error = " + Hex$(error)
ListOut (msg)

End Sub


Private Sub CheckFP_Click()
'////////////////////////////////////////////
'// Sample of Checking F.P. Connection
'////////////////////////////////////////////
Dim bRet As Boolean

bRet = CheckFprinter()
msg = "CheckFprinter = " + boolCheck(bRet)
ListOut (msg)

End Sub

Private Function boolCheck(bVal As Boolean) As String

If bVal = False Then
boolCheck = "False"
Else
boolCheck = "True"
End If

End Function


Private Sub Training_Click()
'////////////////////////////////////////////
' Sample of Training Mode Start Command "T1"
'////////////////////////////////////////////
Dim cmd As String
Dim msg As String
Dim bRet As Boolean
Dim status As Long
Dim error As Long

ListOut ("**Training Mode Start Command**")
cmd = "T1" 'Start Training
bRet = SendCmd(status, error, cmd)
msg = "SendCmd = " + boolCheck(bRet) + " status = " + Hex$(status)
+ " error = " + Hex$(error)
ListOut (msg)
End Sub

Private Sub Training_Stop_Click()
'////////////////////////////////////////////
' Sample of Training Mode Stop Command "T2"
'////////////////////////////////////////////
Dim cmd As String
Dim msg As String
Dim bRet As Boolean
Dim status As Long
Dim error As Long

ListOut ("**Training Mode Stop Command**")
cmd = "T2" 'Stop CASH Closing
bRet = SendCmd(status, error, cmd)
msg = "SendCmd = " + boolCheck(bRet) + " status = " + Hex$(status)
+ " error = " + Hex$(error)
ListOut (msg)

End Sub


Private Sub X_Report_Click()
'////////////////////////////////////////////
' Sample of X_Report Up-Loading Command "U0X"
'////////////////////////////////////////////
Dim cmd As String
Dim msg As String
Dim bRet As Boolean
Dim status As Long
Dim error As Long

ListOut ("**In Up-Loading...**")
cmd = "U0X"
filename = "_X_Report.ASC"
bRet = UploadReportCmd(status, error, cmd, filename)
msg = "UploadReportCmd = " + boolCheck(bRet) + " status = " +
Hex$(status) + " error = " + Hex$(error)
ListOut (msg)

End Sub


Private Sub Z_Report_Click()
'////////////////////////////////////////////
' Sample of Z_Report Up-Loading Command "U0Z"
'////////////////////////////////////////////
Dim cmd As String
Dim msg As String
Dim bRet As Boolean
Dim status As Long
Dim error As Long

ListOut ("**In Up-Loading...**")
cmd = "U0Z"
filename = "_Z_Report.ASC"
bRet = UploadReportCmd(status, error, cmd, filename)
msg = "UploadReportCmd = " + boolCheck(bRet) + " status = " +
Hex$(status) + " error = " + Hex$(error)
ListOut (msg)

End Sub



Private Sub Form_Load()
'///////////////////////////////////////////////////////
' Base Form Initialize
'///////////////////////////////////////////////////////
Label1.Caption = "Time"
Label2.Caption = "Event & Status"
Label3.Caption = "Select Command File (*.dat)"
Label4.Caption = "hhmmss"
Label5.Caption = "ddmmyy"
Label6.Caption = "Input"
With Label7
.Caption = "Please Open Port First!"
.FontBold = True
.FontSize = 12
End With
End Sub
Private Sub ListOut(msg As String)
Dim msg2 As String
Dim cnt As Long

msg2 = Time
msg2 = msg2 + " " + msg

List1.AddItem (msg2)
cnt = List1.ListCount
List1.ListIndex = (cnt - 1)
List1.Refresh

End Sub
Private Sub LisrClear_Click()
List1.Clear
End Sub

Private Sub Dir1_Change()
File1.Path = Dir1.Path
File1.Pattern = "*.dat"
End Sub

Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
End Sub


Massimo Belgrano wrote:
> i dont't kwnow 'FPCTRL.dll'
> Have you a working sample , asoin antother languages?
>
>
>
>

  #4  
Old 06-01-2007, 05:16 PM
Junior Member
 
Join Date: Nov 2009
Posts: 0
Application Development is on a distinguished road
Default Re: BMC international fiscal printer

Massimo,
I had changed two lines and now work, but with some troubles.

Line changed from my program:

PRIVATE BFI_RETORNO
PRIVATE nStatus
PRIVATE nError
PRIVATE cBuf
// ---------------------------
// Abrir puerto comunicaciones
// ---------------------------
BFI_RETORNO := OpenFpctrl( cImpPuerto )
// -------------
// Log on clerck
// -------------
nStatus := Space(4) <----------------- This
change avoid the gpf
nError := Space(4) <-----------------
cBuf := ""
cBuf := cBuf + "o0100001" + Chr(10) + Chr(13)
cBuf := cBuf + "500001" + Chr(10) + Chr(13)
// cBuf := cBuf + "PK008I.V.A. " + Chr(10) + Chr(13)
BFI_RETORNO := SendNCmd( @nStatus, @nError, cBuf )

But the dll is reporting the execution of I/O overlapped ( operación
de E/S sobrepuesta) in a dialog box. But the printer
now work correctly. I need to avoid this messagebox. Seems the form to
call the dll or the returning parameters.
Sorry, my english is bad.
Marcelo Anelli

On 1 jun, 17:58, Marcelo Anelli <m...@sirep.com.ve> wrote:
> Hi Massimo,
>
> the working example from where I use the sample for the
> import command:
>
> '===============================================
> ' Standard Module File for Visual Basic
> '===============================================
>
> '//////////////////////////////////////////////////////////
> '// Fiscal Printer DLL 'FPCTRL.dll' library definitions
> '//////////////////////////////////////////////////////////
> Declare Function OpenFpctrl Lib "FPCTRL.DLL" (ByVal lpPortName As
> String) As Long
> leer más »



  #5  
Old 06-02-2007, 06:22 AM
Junior Member
 
Join Date: Nov 2009
Posts: 0
Application Development is on a distinguished road
Default Re: BMC international fiscal printer

On 2 Giu, 00:16, marceloanelli <marcelo.ane...@gmail.com> wrote:
> Massimo,
> I had changed two lines and now work, but with some troubles.
>
> Line changed from my program:
>
> PRIVATE BFI_RETORNO
> PRIVATE nStatus
> PRIVATE nError
> PRIVATE cBuf
> // ---------------------------
> // Abrir puerto comunicaciones
> // ---------------------------
> BFI_RETORNO := OpenFpctrl( cImpPuerto )
> // -------------
> // Log on clerck
> // -------------
> nStatus := Space(4) <----------------- This
> change avoid the gpf
> nError := Space(4) <-----------------
> cBuf := ""
> cBuf := cBuf + "o0100001" + Chr(10) + Chr(13)
> cBuf := cBuf + "500001" + Chr(10) + Chr(13)
> // cBuf := cBuf + "PK008I.V.A. " + Chr(10) + Chr(13)
> BFI_RETORNO := SendNCmd( @nStatus, @nError, cBuf )
>
> But the dll is reporting the execution of I/O overlapped ( operación
> de E/S sobrepuesta) in a dialog box. But the printer
> now work correctly. I need to avoid this messagebox. Seems the form to
> call the dll or the returning parameters.
> Sorry, my english is bad.
> Marcelo Anelli
>
> On 1 jun, 17:58, Marcelo Anelli <m...@sirep.com.ve> wrote:
>
>
>
> > Hi Massimo,

>
> > the working example from where I use the sample for the
> > import command:

>
> > '===============================================
> > ' Standard Module File for Visual Basic
> > '===============================================

>
> > '//////////////////////////////////////////////////////////
> > '// Fiscal Printer DLL 'FPCTRL.dll' library definitions
> > '//////////////////////////////////////////////////////////
> > Declare Function OpenFpctrl Lib "FPCTRL.DLL" (ByVal lpPortName As
> > String) As Long
> > leer más »- Nascondi testo tra virgolette -

>
> - Mostra testo tra virgolette -


In your working sample you not have used the function OpenFpctrl

Why the returned value from OpenFpctrl (handle) is not passed to
SendNCmd ?
How SendNCmd can recognize the port OpenFpctrl ?


  #6  
Old 06-02-2007, 06:36 AM
Junior Member
 
Join Date: Nov 2009
Posts: 0
Application Development is on a distinguished road
Default Re: BMC international fiscal printer

Massimo:

please see the declaration of the functions.
>From some spare info I detected that you nust:

1- Open communication port with OpenFpctrl. The dll will take care of
comm port.
2- Open clerck and logon
3- Sales
4- Close clerck
5- Report X and Z
6 Close port with Closefpctrl


Is working. But the trouble is in the calling the dll because the dll
is reporting an error of "overlapped I/O operation" with a messagebox.

I had tryed IMPORT instruction with all calling conventions, in fact
the dll is long _stdcall, butt all give the same error.

There is another form for calling dll, with a example?

Marcelo Anelli.

>
> In your working sample you not have used the function OpenFpctrl
>
> Why the returned value from OpenFpctrl (handle) is not passed to
> SendNCmd ?
> How SendNCmd can recognize the port OpenFpctrl ?



  #7  
Old 06-02-2007, 11:59 AM
Junior Member
 
Join Date: Nov 2009
Posts: 0
Application Development is on a distinguished road
Default Re: BMC international fiscal printer

Marcelo

I suggest to use an .C module with code for acess the printer

here an example for one of the functions

Declare Function SendNCmd Lib "FPCTRL.DLL" (status As Long, error As
Long, ByVal buffer As String) As Long

#include "windows.h"
#include "hbapi.h"

typedef LONG (WINAPI * _SENDNCMD)(LONG status, LONG error, LPSTR buffer);

HB_FUNC( SENDNCMD )
{

HINSTANCE handle = LoadLibrary("FPCTRL.DLL");

if (handle)
{
LONG status ;
LONG error;
LPSTR Buffer = hb_parc( 3 ) ;

_SENDNCMD pFunc;

pFunc = (_SENDNCMD) GetProcAddress(handle, "SendNCmd");
hb_retnl( pFunc( status, error, Buffer ) );
hb_stornl( status, 1 );
hb_stronl( error, 2 );
FreeLibrary( handle );
}
}

Regards
Luiz


  #8  
Old 06-04-2007, 08:02 AM
Junior Member
 
Join Date: Nov 2009
Posts: 0
Application Development is on a distinguished road
Default Re: BMC international fiscal printer

Hi Luiz,
Now more confused. I had declared the functions I use, as you can seen
below. But get GPF.
I tryed to load and unload the dll in each functions or on the first
function called (openfpctrl) and unload on the last called (closefpctrl)
but results are the same. Called the function SendNcmd( @status, @error,
buffer) or SendCmd( @status, @error, cmd) give me an GPF. But the best
is that the printer respond to the command, after that give the GPF.

Marcelo Anelli.



#pragma BEGINDUMP

#include "windows.h"
#include "hbapi.h"

HINSTANCE dllhandle;

typedef LONG (WINAPI * _SENDNCMD)(LONG status, LONG error, LPSTR buffer);
typedef LONG (WINAPI * _SENDCMD)(LONG status, LONG error, LPSTR cmd);
typedef LONG (WINAPI * _OPENFPCTRL)(LPSTR ComPuerto);
typedef LONG (WINAPI * _CLOSEFPCTRL)(VOID);

HB_FUNC( OPENFPCTRL )
{
LPSTR ComPuerto = hb_parc( 1 );
dllhandle = LoadLibrary("FPCTRL.DLL");
if (dllhandle)
{
_OPENFPCTRL pFunc;
pFunc = (_OPENFPCTRL) GetProcAddress(dllhandle, "OpenFpctrl");
hb_retnl( pFunc( ComPuerto ) );
}
}

HB_FUNC( CLOSEFPCTRL )
{
if (dllhandle)
{
_CLOSEFPCTRL pFunc;
pFunc = (_CLOSEFPCTRL) GetProcAddress(dllhandle, "CloseFpctrl");
hb_retnl( pFunc() );
FreeLibrary( dllhandle );
}
}

HB_FUNC( SENDCMD )
{
if (dllhandle)
{
LONG status;
LONG error;
LPSTR cmd = hb_parc( 3 );
_SENDCMD pFunc;
pFunc = (_SENDCMD) GetProcAddress(dllhandle, "SendCmd");
hb_retnl( pFunc( status, error, cmd ) );
hb_stornl( status, 1 );
hb_stornl( error, 2 );
}
}

HB_FUNC( SENDNCMD )
{
if (dllhandle)
{
LONG status;
LONG error;
LPSTR Buffer = hb_parc( 3 );
_SENDNCMD pFunc;
pFunc = (_SENDNCMD) GetProcAddress(dllhandle, "SendNCmd");
hb_retnl( pFunc( status, error, Buffer ) );
hb_stornl( status, 1 );
hb_stornl( error, 2 );
}
}

#pragma ENDDUMP



luiz Rafael Culik Guimaraes wrote:
> Marcelo
>
> I suggest to use an .C module with code for acess the printer
>
> here an example for one of the functions
>
> Declare Function SendNCmd Lib "FPCTRL.DLL" (status As Long, error As
> Long, ByVal buffer As String) As Long
>
> #include "windows.h"
> #include "hbapi.h"
>
> typedef LONG (WINAPI * _SENDNCMD)(LONG status, LONG error, LPSTR buffer);
>
> HB_FUNC( SENDNCMD )
> {
>
> HINSTANCE handle = LoadLibrary("FPCTRL.DLL");
>
> if (handle)
> {
> LONG status ;
> LONG error;
> LPSTR Buffer = hb_parc( 3 ) ;
>
> _SENDNCMD pFunc;
>
> pFunc = (_SENDNCMD) GetProcAddress(handle, "SendNCmd");
> hb_retnl( pFunc( status, error, Buffer ) );
> hb_stornl( status, 1 );
> hb_stronl( error, 2 );
> FreeLibrary( handle );
> }
> }
>
> Regards
> Luiz
>
>

  #9  
Old 06-04-2007, 09:51 AM
Junior Member
 
Join Date: Nov 2009
Posts: 0
Application Development is on a distinguished road
Default Re: BMC international fiscal printer

The exact error using the IMPORT command is:


DllExecynaCall() failed!
Se está ejecutando la operación E/S superpuesta.

Maybe correspond to line 506 of dllcall.c

Regards,
Marcelo Anelli

  #10  
Old 06-04-2007, 10:24 AM
Junior Member
 
Join Date: Nov 2009
Posts: 0
Application Development is on a distinguished road
Default Re: BMC international fiscal printer


"marceloanelli" <marcelo.anelli@gmail.com> wrote in message
news:1180968715.443546.207060@n4g2000hsb.googlegroups.com...
The exact error using the IMPORT command is:


> DllExecynaCall() failed!
> Se está ejecutando la operación E/S superpuesta.


> Maybe correspond to line 506 of dllcall.c


This code displays a MessageBox with results of GetLastError(), which is
possibly set by any Windows function. It does not necessarily mean that the
DLL call failed, and probably there is no problem with the IMPORT command.

Sorry to say, it probably does mean you have a problem somewhere else.

It is hard to be clear, but I mean that if you were using VB you would
probably still have the error.

Regards
Alex Strickland


Reply

Thread Tools


Similar Threads

Thread Thread Starter Forum Replies Last Post
Printer-Looking for good printer that prints up to 13 x19 images,any suggestions. TIA usenet Adobe Photoshop 1 08-29-2007 10:17 AM
Example for working with Fiscal printer BMC usenet xharbour 0 06-06-2007 10:00 AM
How to give print command to netwok printer and default printer togather usenet basic.visual 5 06-01-2007 11:38 AM
DLL Impressora fiscal Daruma usenet xharbour 6 04-02-2007 07:07 AM
Win32::Printer::Enum::Printer($server) usenet Perl 10 07-19-2005 10:44 AM


All times are GMT -5. The time now is 08:56 AM.

Managed by Infnx Pvt Ltd.