Is there any way to make the MessageBox behave as modeless?

  • Thread starter krishna.simhadri
  • Start date

K

krishna.simhadri

Hi,

I am developing an automation script(C#) and in that I am displaying a
MessageBox(using system.windows.forms) to alert the user.If the user
responds,then it is fine.But if the user doesn't respond by clicking
on the MessageBox buttons,the dialog is there forever stopping the
code below the MessageBox.show() from executing permanently.

If the message box is of modeless type I can wait for some time and if
the user doesn't respond, I can close the MessageBox and exit.

Is there any MessageBox that is of modeless type or any way to make
the MessageBox behave in modeless manner?

Any help would be appreciated.

Thanks in advance.
 
Ad

Advertisements

J

Jeff Johnson

Is there any MessageBox that is of modeless type or any way to make
the MessageBox behave in modeless manner?
Nope. Windows Forms ultimately calls the Win32 MessageBox() API function,
which always displays the dialog modally. Your best bet is to create your
own form which mimics the MessageBox.
 
Ad

Advertisements

Joined
Dec 24, 2008
Messages
3
Reaction score
0
<krishna.simhadri@gmail.com> wrote in message
news:6375c669-4b53-4edf-83b3-2972bb564757@r15g2000prh.googlegroups.com...

> Is there any MessageBox that is of modeless type or any way to make
> the MessageBox behave in modeless manner?


Nope. Windows Forms ultimately calls the Win32 MessageBox() API function,
which always displays the dialog modally. Your best bet is to create your
own form which mimics the MessageBox.
You can do that by starting another thread. Pass the message to the thread. In the thread call the MessageBox function. But you will have to coordinate the response back to the main code. Run your timing in the main code and if there is no response kill the thread.
 

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

Top