Hi,
The only change I would make to your code is to remove the while loop and
thus the requirement to call Application.DoEvents(), this would I believe be
more friendly to the primary message pump.
OnApplicationIdleEvent()
{
if (AppPausedFlag == false)
{
// Do stuff.
}
}
If you want the system to be more responsive, especially if your Dostuff
takes significant amount of processing time, it might be an option to create
a background thread to perform the work. And you can control the thread with
synchronization objects.
Hope this helps
--
Chris Taylor
http://www.xanga.com/home.aspx?user=taylorza
"JR" <moo> wrote in message
news:3f**********************@news-text.dial.pipex.com...
Hi folks,
Heh, typical as soon as I write this I think of a solution:
OnApplicationIdleEvent()
{
while(AppPausedFlag == false)
{
// Do stuff.
Application.DoEvents();
}
}
static void Main()
{
Application.Run(new Form1());
}
This seems to work... Caveats anyone?
John.
"JR" <moo> wrote in message
news:3f**********************@news-text.dial.pipex.com... Hi folks,
How can I implement the following in C#?
while(AppExitFlag == false)
{
if(AppPausedFlag == true)
{
GetMessage();
// Process messages.
}
else
{
if(PeekMessage())
{
// Process messages.
}
// Do stuff...
}
}
I have a feeling you're gonna tell me this is impossible, I hope you
tell me I'm wrong. :-)
John.