I'm maintaing an MFC application which has the following characteristics:
-It reads information from the Serial port once a second and displays it
- it has a huge OnPaint method. which displays hundreds of bitmaps.
Performance is understandably very bad. I'm assuming it's because the current code calls the MFC OnTimer() function to read the data from the serial port, and then calling the huge OnPaint function, which never completes as it is pre-empted.
I had thought about using threads to prevent this from happening and I need some general advice. Would it be better to put the OnPaint function in a separate thread, or to stop using Timers and put the code that reads from the Serial port in a separate thread? If I do one or both of these things, what specific idiosyncracies does MFC present?
I'm aware the UI already runs in a separate thread but beyond that I've never done any multiprocessing under Windows.