How to check if Form is active

Discussion in 'Questions (Windows Mobile)' started by Mr_Gee, May 5, 2008.

  1. Mr_Gee

    Mr_Gee Active Member Licensed User

    I hope someone can help me,
    Is there a way to have the program check if it is on the foreground?

    I want to make a program which will open a 2nd program, once that 2nd program is finished/closed the focus should go back to my app and it needs to do something else.

    I have tried with Form1.Focus (= true) and Control("Form1").Focus = true
    But I cannot seem to get it working.
    I also thought i might be able to use a Textbox for the focusing part but that
    also didn't do anything.

    The workaround would be to have a MsgBox popup which the user needs to click..
    but that would only be a last resort ...

    I could use some :sign0085:
    Thanks
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    See the ShellAndWait example: http://www.basic4ppc.com/forum/showthread.php?t=2040
    It will make your application wait for the second application to end.
    If I remember correctly your application will be brought to the foreground.
    There are other solutions available, so please reply if it didn't help.
     
  3. Mr_Gee

    Mr_Gee Active Member Licensed User

    it works like a charm, thanks for your help Erel
    :sign0188:
     
  4. pmu5757

    pmu5757 Member Licensed User

    Wait for a sound command stop

    Hello,
    Is it also possible to wait for the end of a B4PPC command like sound?
    I would like to wait for the end of the ".wav" file before doing something else.

    Thank you.
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    If you know the length of the wave file you can add Sleep(...) after playing the sound.
    If I remember correctly the Hekkus sound library allows you to wait for the sound to end.
     
  6. pmu5757

    pmu5757 Member Licensed User

    Wait for a sound command stop

    I don't know the length of the wave file,
    so I'm gonna try the Hekkus lib
    Thank you Erel.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice