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
 

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