Events on separate thread

  • Thread starter Thread starter ms
  • Start date Start date
M

ms

Hi, Is it possible to have event handler for say button click
on main GUI thread on a separate worker thread. So if
button is clcked on main form, the event can be handled in
another thread. I'm using VS2003 and CF1.0 SP3
 
Possible, yes, but first we have to ask "why?"

Event handlers for UI controls occur in the context of the thread that
created them, and that *only* happens if the message pump for them is also
created in that same context. So you'd have to have an Application.Run in
the worker thread context, and that adds some serious complexity and
potential to break your app. I do crazy stuff with the CF and even I would
avoid any kind of architecture like that.

-Chris
 
Back
Top