Solved

Parallel port and MFC

Posted on 2000-04-20
2
745 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
[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
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

717 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