Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: MFC VC++
i want to read the data from USB Port continuously as soon as i press a button and Open a dialog box in MFC? Pls someone help me out?
Thanks in Advance.
Posted 15-Jun-12 22:47pm
Edited 15-Jun-12 22:49pm
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

No, you don't.
 
What you actually want to do is handle the SerialPort DataRecieved messages, and process each byte as it arrives, or transfer them to a buffer for processing in the background.
 
If you try to read continuously, you will lock up your UI and annoy your users...
  Permalink  
Comments
Anurag Kela at 16-Jun-12 5:19am
   
i didn't get you? i want to read the response generated by my hardware on Printer keystrokes as soon as dialog opens.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

There are several applications like that here on CP - search and look through them. Here is one to get you started: CSerialIO - A Useful and Simple Serial Communication Class[^]
 
You tagged C++, so that is the example I added here. There are other nice projects in C# if you are interested.
 
Soren Madsen
  Permalink  
Comments
Anurag Kela at 16-Jun-12 5:17am
   
i have gone through your project before and it really helps to understand the serial communication concept for the freshers like me.
i will tell u what m trying to do.
i m sending a command to my hardware on a button click event and after that m opening a new dialog and i want to read the data from USB as soon as the dialog initializes or simultaneously
Anurag Kela at 16-Jun-12 5:34am
   
My Project deadline are too close n i have to do something on it by monday so pls help me out?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 385
1 Gihan Liyanage 308
2 Sergey Alexandrovich Kryukov 150
3 syed shanu 125
4 ChauhanAjay 120
0 Sergey Alexandrovich Kryukov 9,021
1 OriginalGriff 7,941
2 CPallini 2,603
3 Richard MacCutchan 2,121
4 Abhinav S 1,928


Advertise | Privacy | Mobile
Web02 | 2.8.140827.1 | Last Updated 16 Jun 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100