winforms - Prevent taskbar activating non-modal forms when a modal dialog is active -


Whenever there is a dialog model, I want to stop activation in all my configuration applications. How does this happen? Outlook Work - Open two new mail messages, open an address book from a message and you can not activate the second mail message by clicking on the taskbar or the message window. How can I do this in a winforms application (note that setting ownership does not work)?

Sample application below.

  using System.Drawing; Using System.Windows.Forms; Namespace ConsoleApplication 1 {Class Program {Static Zero Main (string [] Args) {Application.EnableVisualStyles (); Application.SetCompatibleTextRenderingDefault (wrong); application. Play (New Mainform ()); }} Public class MainForm: form {public MainForm () {text = "main form"; Var button = new button {text = "new look"}; button. Click + = (Sender, Args) = & gt; New Form 2 () Show (); //button.Click + = (Sender, Args) => {Var form = new form 2 (); AddOwnedForm (form); Form.Show (); }; Controls.Add (button); button. Place = new point (20, 20); }} Public Class Form 2: Form {Public Form 2 () {Text = "Form 2"; Var button = new button {text = "new modal form"}; button. Click + = (Sender, Args) = & gt; New form (Text = "Model dialog", ShowInTaskbar = false} .ShowDialog (); Controls.Add (button); Button. Location = New point (20, 20);}}}  
< P> To regenerate the behavior, run the application, open two form 2 instances, and then open a modal dialog with another example. Then use the taskbar to activate the first form 2 frequency and above the modal dialog .

Update: Also repros with WPF Windows.

Update: Swan's response Or, it does seem to be a bug and I have reported it to connect. Microsoft.com.

I repro, win7. In addition to creating ownership of these forms, I do not see a clear solution for this, so they do not need a taskbar button, that Windows Window Manager allows active windows to be active quite awkward It often takes an app to get multiple taskbar buttons. It does not allow a very unusual test.


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -