I assure that ShowMessage remains on top

I have several applications and I call ShowMessage ('Complete!'); at the end of a long operation.

In most cases, this works fine, but each time after a while the Message Dialog will appear behind the main form.

Is there any way I can guarantee that ShowMessage will always be on top?

Thanks!

+4
source share
1 answer

Call the Windows MessageBox() API and pass the handle to the active form. In fact, my code uses Application.MainFormHandle all the time, so I'm sure this is a reasonable and simple approach.

This will have an advantage in the quality of the built-in dialogue of the system, and not in the home version of Delphi. It also supports clipboard operations.

If you want to get very interesting, you can use the Vista dialog box, but it is much more complicated and you obviously do not need it for such a simple dialog.

+4
source

Source: https://habr.com/ru/post/1344766/


All Articles