• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 210
  • Last Modified:

Polling a serial connection and updating a SDI FormView.

I have a serial connection that I would like to poll in my SDI application.
How can I run my polling function in the background to update the controls on my dialog view?
Can you please direct me to where I can find information about this or where I could find some example?

Thank you for your help with this.
  • 3
1 Solution
Vinayak KumbarSr Program ManagerCommented:

U can create a thread for monitoring the serial port. Then it will keep on monitoring the port, whenever a message comes, that can display tha data into the edit box of the dialog. I can give U the sample code ( if u give me ur emailID.)

Also ckeck it out in

Try them out.
Vinayak KumbarSr Program ManagerCommented:

I will give the steps.
1. Have the handle for the COM port to be opened as
    HANDLE            g_hPortHandle;

2. Then open the port using CreateFile(...);
3. use SetCommMask(...)
4. use SetCommState(...);
5. use SetCommTimeouts(...)
6. use AfxBeginThread(), to launch Ur thread.
7. In the thread create the event as
    OVERLAPPED overLapped;      //Overlapped Structure
    //Create The Event
    overLapped.hEvent = CreateEvent(NULL, FALSE, FALSE,     NULL);
8. Wait fo rthe com event using
9. Whenever U get EV_RXCHAR event, read the buffer using     ReadFile and store/diplay it.

For using all these functions, u have fill the required structures with proper values.

That is the basic flow.
Hope this helps u (I have a simple sample to monitor the incoming data from the COM port)

drodgersAuthor Commented:
Thank you again VinExpert for your help.  I would like to look at your sample application if you don't mind.  My email address is dionrodgers@hotmail.com.  I wish you a warm holiday.
Vinayak KumbarSr Program ManagerCommented:

Thanks, I wish the same to U.
I have sent u the simple sample.
Check it out


Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now