Le forum (ô combien francophone) des utilisateurs de Powerbuilder.
Bonjour à tous,
J'ai développé un Logiciel d'encaissement et il me reste à communiquer avec une imprimante chèque et l'afficheur client en utilisant la norme OPOS,
l'imprimante en question est TM H6000.
Tout ce que je trouve sur le net c'est des dll à utiliser avec VB mais rien sur PowerBuilder.
Pourriez-vous me communiquer des tuyaux ?
Quelqu'un a déjà réalisé un projet dans ce contexte ?
Merci.
SugarRc
Hors ligne
Bonjour, en principe tu peux appeler les mêmes dll depuis PB
http://pbadonf.fr/forum/viewtopic.php?id=54
Hors ligne
Je te remercie pour ta réactivité, en fait ce ne sont pas des dll, mais des modules écrits en VB comme Opos.vb et Oposepson.vb
que je pourrais à la limite recoder en PB, mais çà prendra du temps. Je pense que je ne suis pas le seul à chercher des exemples faits en PB.
SugarRc
Hors ligne
Hors ligne
Merci à toi, c'est très instructif!
Hors ligne
Pour info, le code :
Richard Coleman a écrit:
The instance variables are:
Code: pb
Private: OleObject oPOSPrinter boolean ib_Created = FALSE string is_DataToPrint long il_LineSize integer ii_LineCount // Some printer specific constants CONSTANT LONG PTR_MM = 4 CONSTANT LONG OPOS_SUCCESS = 0 CONSTANT LONG PTR_S_SLIP = 4 CONSTANT LONG OPOS_E_TIMEOUT = 112 CONSTANT LONG OPOS_E_ILLEGAL = 106 CONSTANT LONG OPOS_EPTR_COVER_OPEN = 201 CONSTANT LONG OPOS_EPTR_SLP_EMPTY = 204 CONSTANT LONG OPOS_E_EXTENDED = 114 CONSTANT string is_CRLF = '~r~n' CONSTANT string is_Esc = char('~h1B')The code to initialize it is in a function:
Code: pb
// This function opens the connection to the POS Printer, claims the device and // sets it up for appropriate printing. long ll_ReturnValue string ls_Params[] // Create the Active X Object oPOSPrinter = CREATE OleObject ll_ReturnValue = oPOSPrinter.ConnectToNewObject ( "OPOS.POSPrinter" ) IF ll_ReturnValue <> opos_success THEN // gnv_app.inv_error.of_Message ( 'ACC-00096' ) RETURN -1 END IF // Open the unit ll_ReturnValue = oPOSPrinter.Open('Unit1') IF ll_ReturnValue <> opos_success THEN gnv_app.inv_error.of_Message ( 'ACC-00097' ) RETURN -1 END IF // And get exclusive access to it ll_ReturnValue = oPOSPrinter.ReleaseDevice() ll_ReturnValue = oPOSPrinter.ClaimDevice(1000) IF ll_ReturnValue <> opos_success THEN IF ll_ReturnValue = OPOS_E_ILLEGAL THEN ls_Params[1] = 'being unable to locate the slip printer' ELSE ls_Params[1] = 'unknown error #' + string ( ll_ReturnValue ) END IF gnv_app.inv_error.of_Message ( 'ACC-00098', ls_Params ) RETURN -1 END IF // Set some properties oPOSPrinter.DeviceEnabled = TRUE oPOSPrinter.MapMode = PTR_MM oPOSPrinter.SlpLetterQuality = True ib_Created = TRUE RETURN 1
Hors ligne