does ShowDialog start new thread ?

  • Thread starter Thread starter shark
  • Start date Start date
S

shark

Hi,

Does Form.ShowDialog() start new thread ?
If yes how is solved cross-thread operations?

Thx
 
shark said:
Hi,

Does Form.ShowDialog() start new thread ?
If yes how is solved cross-thread operations?

Thx

No, it doesn't.
 
No, it doesn't.

I was under a notion that Show and ShowDialog would executeon a
different thread. Seems interesting..Thanks Lasse.
 
I was under a notion that Show and ShowDialog would executeon a
different thread. Seems interesting..Thanks Lasse.

Every window should have a thread to process messages, right?
 
Hmm, I think that this is not a proof, because each modal window have it's
own message queue and that's why code after ShowDialog will not execute.


Paul E Collins said:
"Aneesh Pulukkul [http://dotnet-revolutions.blogspot.com]"
I was under a notion that Show and ShowDialog would executeon a different
thread.

Try putting code after ShowDialog. It won't run until that second window
closes. If ShowDialog just launched another thread, the code after
ShowDialog would run immediately.

Eq.
 
shark said:
Hi,

Does Form.ShowDialog() start new thread ?
If yes how is solved cross-thread operations?

This may not be a perfect test, but I just ran a simple form with a CancelButton
setup using ShowDialog(), and had the threads window open in VS2005 (Debug ->
Windows -> Threads) and no new threads appeared to spawn to handle the dialog.

There may be other reasons why that happened though.

Chris.
 
So in our cases we have two windows: first is main form window and the
second in modal dialog.

Are they created in the same thread?
How many message pump do we have in this case (seems like 2)?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top