-
I used MessageBox only for debug purposes, and to exhibit the absolute madness that is wreaking havoc on my thread.
I'm not sure what I would use PostThreadMessage for as all messages are sent one way, from the Thread func to the UI thread, in which case, isn't SendMessage just as good then?
-
SendMessage needs a window handle as the target and blocks. PostThreadMessage needs a thread ID or handle and returns immediately.
Since you're always sending to the UI thread, the blocking is the more important difference.
-
Which is why I wasn't quite sure why I would use PostThreadMessage here, since SendMessage is clearly the desired behaviour in this case. Nevertheless though, I am in the process of re-writing the thread, this time I will do only bare-bones calculations in the thread and pass a list of processed info back to the caller so that it can be used to update the UI. My initial intent was for the UI updating to be a part of the thread itself so that updating would not block/eat up time from the window function, but hopefully this time will be negligible, we'll see.