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
Solved

Parallel port and MFC

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Need a Shell script to start a service checking the port 6 52
difference between String.subString() and String.subSequence() 6 234
sum67 challenge 35 107
withoutTen challenge 14 131
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.

839 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