Solved

write a byte to the parallel port under NT4.0?

Posted on 1997-05-02
1
331 Views
Last Modified: 2013-12-04
I tried to write a byte to the parallel port in this way:

      HANDLE hLPT;
      DWORD nNumberOfBytesWritten;
      BYTE  ccb;
      BOOL bWriteFile,bCloseHandle, bWait=FALSE, bOVResult;
      OVERLAPPED st_Overlapped;
      ccb=1;

      hLPT=CreateFile("LPT1",GENERIC_READ|GENERIC_WRITE,0,NULL,OPEN_EXISTING,FILE_FLAG_OVERLAPPED,NULL);
      bWriteFile=WriteFile(hLPT, &ccb, 1, &nNumberOfBytesWritten, &st_Overlapped);
      bCloseHandle=CloseHandle(hLPT);      

This works only if I have installed a printer driver to lpt1! Then, after proceeding, a print message window opens and tells me there is no paper in the printer, but I will not print!!!
I need a solution with about 10 or 20  rows, not a complicated VxD driver or something.
0
Comment
Question by:nil_dib
1 Comment
 
LVL 2

Accepted Solution

by:
gysbert1 earned 50 total points
ID: 1397072
I'm afraid you'll have to use a "complicated VxD" You're trying to access the printer port through the printer driver. It looks at the status lines on the port, and detects a paper out error. What you need is driver that allows arbitrary access to the port.

I know you're not using Delphi, but try this anyway:

Go to the Delphi superpage (sunsite.icm.edu.pl), click on search and type "port hardware" and click the 32 bit checkbox. The first result is a delphi component to allow arbitrary port access. It includes a VxD, which allows arbitrary port access. You should be able to use this VxD with your program as well...
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

777 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