me 0

me 0

  • NA
  • 3
  • 0

Launching a window from a worker thread? Please Help

Feb 16 2005 1:28 PM
Please, i really need help. Im doing a project for my 4th year of college, its going perfect, until now. Its an instant messaging program. A thread is started when you logon called incomingMessage. incomingmessage loops, listening for an incoming message, when it receives one, it processes it, if its an alert or a message (an "instant message") it passes it back to the main program, via a delegate. however, i cant make an IM Window popup no matter what i do. it seems its still a different thread, and only the GUI thread can sucessfully create windows. I CAN create a window by making its default constructor begin in another new thread, and kick off a modal (dialog) version of itself (this.ShowDialog(null) ), it works, to an extent, but its not the way to go, the thread is waiting for the window to close, and its just messy and definitly NOT the solution for more than one IM window. Does anyone have any ideas on how to get the GUI thread to know a message has arrived, and let it open up the window itself? I tried events, flags etc, but any event delegate seems to be operating in its own thread. Im about to go home and try MSMQ (Message Queueing) to see if that'll work. Does anyone have any ideas? Would greatly appreciate the help Thank you

Answers (2)