Executing a function from another thread.
Hey guys, first post here so I hope you can help :D
Basically i'm making a simple Instant Messanger program for a data communication projects. I didn't really know anything about socket/thread programming prior to this so i'm trying to work my way through just to get it finished in time. The program works great except that I wanted to add functionality that would load a window when a message is received from a user [as typical messangers do]. I have the window designed and everything works when I load it from the application, however I have a seperate thread listening for incoming connections/data, parsing, and executing commands based on the messages. If I try to pop up a chat window from inside the socket thread it ends up crashing the program whenever I try to interact with it. I'm pretty sure this is because the socket thread doesn't have the win32 messages loop stuff that's required to get feedback from windows.
In short: I'd like to find a way to call a function from the main program by sending some short of message back from the thread doing the socket information. That way the window should load without programs and be able to have interaction from the user.
Does anyone know of a simple way to implement this?