Solved

Parallel port and MFC

Posted on 2000-04-20
2
734 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

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