Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Write String to COM Port
Message
From
01/11/2004 00:56:04
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8
OS:
Windows XP SP2
Miscellaneous
Thread ID:
00955494
Message ID:
00956444
Views:
10
>I need to write directly to a Com port... what have you done/used that was successful?
Here's what I do


Function Write2ComPort
Lparameters tcComPort, tcString
* PASS the COMPORT and the string to send to it
* eg "COM1:","ABCDEF"
#Define ForReading 1
#Define ForWriting 2
oWshFile = CREATEOBJECT("Scripting.FileSystemObject")
If TYPE("oWshFile") #"O"
Return .F.
Endif
oCom = oWshFile.OpenTextFile(tcComPort, ForWriting, .T.)
oCom.Write(tcString)
oCom.Close
Release oCom
Release oWshFile
Return

HTH
Previous
Reply
Map
View

Click here to load this message in the networking platform