How to display a MessageBox as topmost window

Hi,

I'm looking for a way to display a MessageBox as the topmost window.
Any Ideas on how to do this using .NET / WindowsForms

Thanks,

Erik


Answer this question

How to display a MessageBox as topmost window

  • vinutha

    Thanks for your research and giving use a good information...
  • Nitesh Menon

    isn't it already a modal window  
  • KeeperOC

    I found a solution myself. It's straightforward to call the original Win32 MessageBox API:

    [DllImport("user32.dll")]
    public static extern int MessageBox(int hWnd, String text, String caption, uint type);

    Once this is done I can include the MB_TOPMOST constant in the type to get it to be topmost.

    Erik

  • mike93108

    Yeah, but it's application modal nit system modal...
  • Earl Jr

    Hi,

    Message box always open as the model window. So it will remain on top if your application is set to be the top most....

    Therefore your can try these..

    1) Just before poping up the Messagebox just make your application got focus and set it to be top most...
    Than open your message box..

    OR

    2) simply make your own Message box Dialog form and set the form as top most and than pop up that custom message box....


  • How to display a MessageBox as topmost window