Solved

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

Posted on 1997-05-02
1
328 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

757 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now