Results 1 to 5 of 5

Thread: Prevent form from coming to front

  1. #1

    Prevent form from coming to front

    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.
    The views expressed on this programme are bloody good ones. - Fred Dagg

  2. #2
    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...

  3. #3
    PGDCE Developer Carver413's Avatar
    Join Date
    Jun 2010
    Location
    Spokane,WA,Usa
    Posts
    206
    In lazarus you can use this to lock focus to a single form, I believe this will work with delphi as well.

    Form.ShowModal;

  4. #4
    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
    The views expressed on this programme are bloody good ones. - Fred Dagg

  5. #5
    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.
    BringWindowToTop(Application.Handle);
    SetForegroundWindow(Application.Handle);
    SetActiveWindow(Application.Handle);

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •