G
Guest
When I have a long process to run I can create a new thread to run it and
create a modal dialog on my GUI thread. The modal dialog prevents any
messages (like button clicks) from working on my main Form. It also provides
a message loop, which allows paint messages and calls to the Control::Invoke
function to run. I can use these to invalidate an area and update it with
intermediate results of my process. When the process is done, I close the
modal dialog and everything works fine.
How can I do this, in .Net, without a modeless dialog?
I tried using Monitor to block the GUI thread. This prevents a message loop
from running. When I call Invoke from my process thread to invalidate an
area, it just hangs. It seems I will need a message loop. The only things I
can find to create a message loop are Application::Run and Form::ShowDialog.
The first throws an exception because I have already called it and the second
requires a modal dialog.
create a modal dialog on my GUI thread. The modal dialog prevents any
messages (like button clicks) from working on my main Form. It also provides
a message loop, which allows paint messages and calls to the Control::Invoke
function to run. I can use these to invalidate an area and update it with
intermediate results of my process. When the process is done, I close the
modal dialog and everything works fine.
How can I do this, in .Net, without a modeless dialog?
I tried using Monitor to block the GUI thread. This prevents a message loop
from running. When I call Invoke from my process thread to invalidate an
area, it just hangs. It seems I will need a message loop. The only things I
can find to create a message loop are Application::Run and Form::ShowDialog.
The first throws an exception because I have already called it and the second
requires a modal dialog.