Click here to Skip to main content
16,019,018 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Updated 15-Jun-12 22:49pm
v2

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...
 
Share this answer
 
Comments
Fresher16 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.
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
 
Share this answer
 
Comments
Fresher16 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
Fresher16 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900