Solved

Parallel port and MFC

Posted on 2000-04-20
2
731 Views
Last Modified: 2013-11-20
How can I use paralel port with MFC, or API.
Note: I don't want to send to printer, I want to send data through parallel port to a device made by me.
0
Comment
Question by:Razvan
  • 2
2 Comments
 

Expert Comment

by:b_samrat
ID: 2737293
hi
You can use CreateFile to get a handle
to the LPT1(parallel port),and use Writefile and ReadFile to send or recive data to or from the device.


m_hComm = CreateFile(LPT1,                       GENERIC_READ |GNERIC_WRITE,           0,NULL,OPEN_EXISTING,                 OPEN_EXISTING
           0,0);


Best Luck
Samrat
0
 

Accepted Solution

by:
b_samrat earned 50 total points
ID: 2737352
hi
You can use CreateFile to get a handle
to the LPT1(parallel port),and use Writefile and ReadFile to send or recive data to or from the device.


m_hComm = CreateFile(LPT1,        GENERIC_READ |GNERIC_WRITE,      0,NULL,OPEN_EXISTING,      OPEN_EXISTING
     0,0);

ReadFile(m_hComm,
(void*)m_pstrReadBuffer,//RX Buffer Pointer
INBUFSIZE,//Size of Buffer
&BytesRead,//no. of bytes
NULL);

bResult = WriteFile(m_hComm,
m_pstrWriteBuffer,  //TX Bufferpointer
OUTBUFSIZE, //Size of Buffer
 &dwLength,//no. of bytes writen
NULL);          


Samrat


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 is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

743 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

13 Experts available now in Live!

Get 1:1 Help Now