I am trying to figure out Messagebox( ownerWindow, … ).
Using reflector I see that the ownerWindow defaults to the ActiveWindow for the thread.
So the only time I need the ownerWindow parameter is to call Show from another thread.
However when I try this, I get a cross threading exception.
private void button1_Click( object sender, EventArgs e ) { new Thread( () => MessageBox.Show( this, 'Test' ) ).Start(); }
So it looks like the only time I need the explicitly state the owner window, I cann’t use it!
You may want to take a look at Win32 Window Hierarchy and Styles to understand the difference between owner and parent windows. It’s not always necessary that the ActiveWindows needs to own the messagebox, I’ve worked on application where the ActiveWindow was not necessarily the owner of the MessageBox.
Also according to win32 window rules control hierarchy cannot have controls created on different threads which is why you need to marshall the call to the MessageBox.Show to the parent window’s thread.