Relative Content

Tag Archive for multithreadingmfcpostmessage

mfc worker thread needs to wake UI to run multiple functions

My UI creates a file extracts the data into a global vector and closes the file. The UI then runs a worker thread and becomes idle waiting for user or worker actions. The worker thread works on the data from the UI then does PostMessage to signify it is done. The UI’s ONMESSAGE handler DOES get the message, then calls a function to write the modified data back to the file (re-opening it as modeCreate). The function gets control (a debug MessageBox gets displayed) and the open is attempted. At that point, I get an exception. In debug mode, I can see that all pointers seem valid and the file appears to have a valid handle.