Write data to COM/LPT ports without using the API
This simple yet effective code lets you send any data to the COM/LPT ports on the computer.
Original Author: Jordan Bayliss-McCulloch
Side Effects
If the data is sent to the printer port (LPT1/2) and the printer is off or not connected, the program may freeze.
Code
Dim strTest as String
strTest = "This is the data I want to write."
'This will write strTest to LPT1
Open "LPT1:" For Output Access Write As #1
Print #1, strTest
Close #1
'This will write strTest to COM1
Open "COM1:" For Output Access Write As #1
Print #1, strTest
Close #1
'It's that simple!
Loading Comments ...
Comments
No comments have been added for this post.
You must be logged in to make a comment.