Hide application at startup - Then display it when requested.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Automan
    Indigo Rose Customer
    • Oct 2009
    • 92

    Hide application at startup - Then display it when requested.

    Hi Everyone,

    This one has got me tricked. I've searched the forums and the
    closest I have got to achieving this is Worm's suggestion in the
    startup actions.

    Window.SetSize(Application.GetWndHandle(), 0, 0)

    Im running the project as a flat window as suggested.

    I can get the handle of the "hidden" application no problem.

    I have verified this by a dialog that spits up the numeric value
    of the handle.

    Now the question, how do I make this application appear again
    from another AMS app which Im using to launch it.

    I have tried Window.Show, Window.Maximize (all with the handle)

    and the following that I thought would surely work:

    Window.SetSize(Myapp_handle, 1280, 1024);

    (tried variations on the window size, just in case it was that)

    This is driving me crazy, I know I have the correct handle.

    Or alternatively is there another way to launch an AMS application
    minimized or hidden in a way it can later be relaunched from a secondary
    AMS app?

    Many thanks if someone has the answer, Its something I can do
    with relative ease in other scripting languages so Im not sure if
    its me, LUA, or limitations in AMS.
    Last edited by Automan; 04-13-2012, 06:42 PM.
  • Mick
    No longer a forum member
    • Feb 2012
    • 173

    #2
    hide it with this;



    Now the question, how do I make this application appear again
    from another AMS app which Im using to launch it.
    If its running then there is little you can do, maybe create a ini file and have your other app read it on a timer or something on a while loop or something.

    I would say the while loop would eat cpu while a global timer checking an ini every 2/3 seconds would not.

    Comment

    • Automan
      Indigo Rose Customer
      • Oct 2009
      • 92

      #3
      Originally posted by Mick View Post
      hide it with this;





      If its running then there is little you can do, maybe create a ini file and have your other app read it on a timer or something on a while loop or something.

      I would say the while loop would eat cpu while a global timer checking an ini every 2/3 seconds would not.
      Its relatively easy to pass variables/handles between the apps, you can even write the variable to a txt file from app "a" and then grab it from that file with app "b".

      I'll try moving it off screen as you suggest and see if that helps any,
      thankyou for reply.

      To me it seems like a secondary AMS instance will not perform its operations
      on handles generated by another instance. If someone can say "Yes thats
      the way AMS is" then I would probably stop bashing my head. I have been
      able to share handles in windows between apps I've written in various
      other scripting languages that appear to call the same API's as LUA/AMS
      does. Syntax of the scripts looks familiar as other scripting language also.

      Im obviously missing something obvious here.

      Comment

      • Cybergraph
        Indigo Rose Customer
        • Feb 2007
        • 1633

        #4
        Basically we have two apps:
        - App "A" starts by itsself hidden;
        - App "B" should control the visibility of app "A" using the window handle

        You should proceed as follow:
        - first, to have app "A" invisible, use a mask that will cover completely the app;
        - when app "A" starts, writes its window handle in an INI file;
        - app "B" will read the window handle of app "A" in the INI file and will use it to send a Window.SetMask (app_A_handle, "") command;
        - in the same way, when you want to hide again the app "A", send Window.SetMask (app_A_handle, mask_file_path)

        Obviously, other commands (like "Window.Hide") can be sent in this way.

        Note: On Windows 9x systems, this action will only work on AutoPlay created windows at runtime. This means masks cannot be applied to any windows belonging to other programs on Windows 9x systems.
        We are slowly invading your planet to teach lazy humans to read the user manual.
        But don't be scared: we are here to help.

        Comment

        • Cybergraph
          Indigo Rose Customer
          • Feb 2007
          • 1633

          #5
          Originally posted by Cybergraph View Post
          - when app "A" starts, writes its window handle in an INI file;
          You can also use the functions Window.EnumerateTitles or Window.EnumerateProcesses to get, inside app "B", the handle of app "A", without the need of using the external INI, and then manage its window as previously described.
          We are slowly invading your planet to teach lazy humans to read the user manual.
          But don't be scared: we are here to help.

          Comment

          • Automan
            Indigo Rose Customer
            • Oct 2009
            • 92

            #6
            Originally posted by Cybergraph View Post
            You can also use the functions Window.EnumerateTitles or Window.EnumerateProcesses to get, inside app "B", the handle of app "A", without the need of using the external INI, and then manage its window as previously described.
            Thankyou Cybergraph !

            I have never used masks before, and this is a great way to achieve what
            I wanted. I understand your examples of passing the windows handle
            between the two applications. I've even dumped it to the clipboard at
            times.

            I had to make my own mask to cover entire screen, but that was easy
            enough. I think this is neat approach.

            For the life of me I dont understand why IR does not make an Application.Hide
            for use in the startup actions. It would make these such projects a lot easier.

            Thanks again !!

            Comment

            • Cybergraph
              Indigo Rose Customer
              • Feb 2007
              • 1633

              #7
              Glad to be of help.

              P.S. I would not use the clipboard: could be influenced or interfere with other data passed by the user.
              I would prefer to use the direct way, getting the handle from the enumerated processes/windows.
              I'ts just a suggestion.
              We are slowly invading your planet to teach lazy humans to read the user manual.
              But don't be scared: we are here to help.

              Comment

              Working...
              X