Hi Everybody,

The alarm manager in my Windows Forms application has a alarm control
(User control) that is used to display errors.
This is created on the Main thread. Whenever any calls are made on this
control to display errors, we take care to switch to the Main thread
(windows principle: thread that creates the window services the window)
using


            private void OnAlarmMessageReceived(AlarmMessage msg)
            {
                  if(InvokeRequired) // Pass on to GUI thread
                  {
                        BeginInvoke(new
AlarmMsgReceivedHandler(OnAlarmMessageReceived), new Object[] { msg } );
                        return;
                  }
                  // whatever needs to be done
            }

This works fine but with the requirement that the main thread is free.
Now, there are many situations where it is difficult to free the main
thread but there are errors that need to be displayed.
What I need is a UI thread  that remains alive during the application
lifetime on which I can create and service the alarm window. In the
managed world (using C#) , how do we create a thread with a message pump
as opposed to a worker thread  ?

Any help is greatly appreciated.

Thanks in advance,
Aman


===================================
This list is hosted by DevelopMentor®  http://www.develop.com
Some .NET courses you may be interested in:

NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnetls

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to