Closing a modal dialog programatically

  • Thread starter Thread starter Randy A. Ynchausti
  • Start date Start date
R

Randy A. Ynchausti

Dear all,

Within a C# application, I need to start a background thread that:

1) watches for a dialog to appear
[The dialog will be opened using MessageBox.Show()]
2) finds a button labeled "OK" on the dialog
3) pushes the button
4) terminates

Anybody have any ideas on how to watch for a dialog from a background thread?

Thanks and regards,

Randy
 
Hi Randy,

If you have no reference to this modal form or you have no
handle then there's no direct way to achieve this.

MessageBox doesn't show as an Form.ActiveForm or
evens as an Owned form.

I can only recommend to write your own Dialog with this
functionality.

Regards

Marcin
 
Back
Top