Information générale
Catégorie:
Contrôles ActiveX en VFP
You are write. The first method is the one I was looking for. I just count not figure out how to imbed CHR(0) into a text file. Below is the sample code I used.
Thanks A Million.
Raz
*-- PS_DRW_OPEN
lcPort = UPPER(ALLTRIM(_Screen.cDrw_port))
DO CASE
CASE lcPort = 'NONE'
RETURN
CASE SUBSTR(lcPort,1,3) = "LPT"
IF FILE("C:\vUAS\CONTROL.CHR") = .T.
WAIT WIND "...Opening drawer" NOWAIT
*-- Get Default Printer
=APRINTERS(PP)
lnI = ALEN[PP,1]
FOR lnI =1 TO lnI
IF AT("RECEIPT", UPPER(ALLT(PP[lnI,1])) ) > 0
SET PRINTER TO NAME PP[lnI,1]
* !TYPE F:\vUAS\CONTROL.CHR >LPT1
!TYPE C:\vUAS\CONTROL.CHR >LPT1
WAIT CLEAR
EXIT
ENDIF
ENDFOR
ENDIF
RETURN
CASE SUBSTR(lcPort,1,3) = "COM"
* load mscomm
*ThisForm.oComm = CREATEOBJECT('MSCOMMLib.MSComm')
DO CASE
CASE lcPort = "COM4"
ThisForm.oComm.CommPort = 4
CASE lcPort = "COM3"
ThisForm.oComm.CommPort = 3
CASE lcPort = "COM2"
ThisForm.oComm.CommPort = 2
OTHERWISE
ThisForm.oComm.CommPort = 1
ENDCASE
IF EMPTY(_Screen.cDrw_init)
ThisForm.oComm.Settings = "9600,N,8,1"
ELSE
ThisForm.oComm.Settings = ALLTRIM(_Screen.cDrw_init)
ENDIF
*-- If port is open close it first
IF ThisForm.oComm.PortOpen
ThisForm.oComm.PortOpen=.F.
ENDIF
ThisForm.oComm.RThreshold = 1
ThisForm.oComm.SThreshold = 1
ThisForm.oComm.RTSEnable = .F.
ThisForm.oComm.InputLen = 0
ThisForm.oComm.PortOpen = .T.
ThisForm.oComm.output = ALLTRIM(_Screen.cdrw_code)
*-- Close the port
ThisForm.oComm.PortOpen = .F.
ENDCASE
RETURN
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement