?
Solved

Parallel port and MFC

Posted on 2000-04-20
2
Medium Priority
?
750 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 200 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

Independent Software Vendors: 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

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: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses
Course of the Month10 days, 20 hours left to enroll

770 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