0

In my project I have a MessageBox that pops up from time to time.

When I'm playing a game and the MessageBox appears, the game is minimized and I'm back to the desktop. This might depend from app to app, but this specific app/game minimizes when MessageBox appears.

How to avoid this behavior? Is there anything I can do to the MessageBox to make it lose focus/not activated ? I tried to look at the MessageBox methods but no luck.

John Saunders
  • 160,644
  • 26
  • 247
  • 397
sparcopt
  • 416
  • 2
  • 8
  • 22
  • 3
    MessageBox is a Modal element, meaning that everything stops until you dismiss it. The best way to deal with it is to not show the message box in the first place. If you still need the functionality of a message box without the modal behavior, use a non-modal form. – Robert Harvey Jul 11 '14 at 00:15
  • Use a customize `Windows Form` like a `MessageBox Dialog` so it will behave as you like. – bumbumpaw Jul 11 '14 at 00:23
  • if **the game** is not part of your program and it may using `DirectX`, I think nothing you can do – Prisoner Jul 11 '14 at 01:31

1 Answers1

0

It sounds like you want the message box to be able to display while the rest of your code is still running. Type of messagebox you are using is modal and needs to be closed until it allows you to interact with the other open window.

I suggest you start a new thread for the message box so that the thread can continue to run allowing you to be able to interact with the other windows.

etr
  • 1,252
  • 2
  • 8
  • 15