View Full Version : Prevent form from coming to front

20-02-2011, 10:46 PM
I have a problem that seems to have gotten worse with Windows 7 - I need suggestions - HELP!

My app is fullscreen and presents the user with a list of exercises to do. When user double click an exercise the app "launches" a new app that should appear over the top of the original app.

The problem I have is that a user can launch the exercise application but continue to click on the main application, the effect is that the exercise that is launched appears behind the main application and cannot be accessed unless the user does a alt-tab on the keyboard.

When the launch occurs I would like so that the zorder cannot be changed by use of a mouse button. i.e, the program that is launches always successfully starts infront.

Sounds simple but it is proving to be a pain to achieve any help or suggestions welcome.

21-02-2011, 12:55 AM
On 1 application i'm using form.BringToFront. May or may not be what you are after. There's more you can test with, like Application.Restore...

21-02-2011, 02:18 AM
In lazarus you can use this to lock focus to a single form, I believe this will work with delphi as well.


21-02-2011, 06:59 PM
Thanks for replying. I haven't seen application.restore before, I will check out what that does. The showmodal is great when you have multiple forms within same project but I have an issue where I have to launch another exe that in turn opens up dlls containing software for the students to work on. It has always worked well in the past. Anyway, I have since got a work around that seems to be holding. fingers xed

21-02-2011, 08:27 PM
you can try some of these calls with the application that you want to bring up. I guess it's best to call them on FormShow if you are using a form event.