Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
MSCOMM32 write method?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Divers
Thread ID:
00283794
Message ID:
00283833
Vues:
9
>I have this working so far:
>* load mscomm
>oComm = CREATEOBJ('MSCOMMLib.MSComm')
>* Open and Initialize COM port #1 for use
>oComm.CommPort = 1
>oComm.Settings = "9600,N,8,1"
>oComm.InputLen = 0
>oComm.PortOpen = .T.
>
>I have a text file Lable.txt that I want to push to my label printer. When I look at the methods in the debugger I don't see anything but output to push that file. Anyone done this before?
>

MSCOMM doesn't deal with files - it sends and receives character streams. You'd have to write the file out to MSCOMM32 using the Output property.

buffer = FILETOSTR('Label.txt')
oComm.output = buffer

will work with small files, or you can use low-level file I/O to read a line at a time from the file and stuff it out the control - you'll need to make sure to send CR/LFs if you read a line at a time from the file.

>buffer='Label.txt'
>oComm.output = buffer
>
>* Close the port
>oComm.PortOpen = .F.
>release oComm
>
>
>Only problem is that nothing happens at the printer???
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform