Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

How to send bytes to an parallel port (LPT1)

Posted on 2003-03-19
5
Medium Priority
?
485 Views
Last Modified: 2012-05-04
Dear Gentlemen:  
I need to send bytes to the parallel port of the computer (LPT1 or LPT2). The connected device to the port is not a printer. As I can make this from Delphi?

Thanks,


Mauro Badalacchi R.
0
Comment
Question by:mbrlaser
5 Comments
 

Author Comment

by:mbrlaser
ID: 8169192
Thanks emadat, but the code 'Out Dx,Ax' return error 'Privileged Instruction'. Is it necessary to place some directive so that this operation is allowed?
0
 

Expert Comment

by:WhoPhlungPoo
ID: 8170062
Hello,

     In order to directly access any port under Windows, you need a device driver, there are several components that have what you need, here is one of them:

ZLPortIO

You can download it from www.torry.net
0
 

Accepted Solution

by:
Galaa earned 750 total points
ID: 8171298

1. FHandle := CreateFile('LPT1', GENERIC_READ or GENERIC_WRITE, FILE_SHARE_READ
or FILE_SHARE_WRITE, nil, OPEN_EXISTING, 0, 0);

2.NumberOfBytesToWrite := Length(Str);
EMStr := PChar(LocalAlloc(LMEM_FIXED, NumberOfBytesToWrite + 1));

CharToOem(PChar(Str), OEMStr);

 WriteFile(FHandle, OEMStr^, NumberOfBytesToWrite,
FNumberOfBytesWritten, nil)



0
 

Author Comment

by:mbrlaser
ID: 8171395
I already proved this option and it works well. It is necessary to include

closehandle(FHandle);

so that the data are sent to the port.

Thanks Galaa.
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses
Course of the Month15 days, 7 hours left to enroll

575 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question