Solved

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

Posted on 1997-05-02
1
335 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Vb.Net Loading Word 11 109
Microsoft App Store does not Download and Update the apps in Windows 10 5 104
VS2015 Redefinition errors 4 104
PL SQL Developer 7 90
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…
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

739 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