Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2005
    Location
    Australia
    Posts
    21

    Opening - Monitoring External Windows

    I have attached an example of a method to:
    1. Browse for a file
    2. Get the selected files default viewer
    3. Launch and monitor the opening of the default viewer
    4. Get the window handle of the default viewer
    5. Hide the AMS window
    6. Set the title text of the default viewer
    7. Monitor the closing of that default viewer window
    8. Show the AMS window

    The application does an initial check after opening the selected file and runs a function to monitor if the files viewer is open checking every 1/2 second then hides the AMS application

    If the default viewer isn't in the table of enumerated processes (slow opening) then it waits 5 seconds and further checks if the window has been opened.

    On opening the files default viewer it changes the window title text (A prompt to close the window to return to the AMS application)

    On closing the default viewer window the AMS window shows

    I am sure many users could appreciate having such an example, (I know that I would have) please feel free to correct any code, error handling as you see fit.

    Hope this is useful to many users!
    Attached Files
    Last edited by Intrinsic; 03-31-2005 at 07:33 PM.

  2. #2
    Join Date
    Oct 2001
    Location
    Norway
    Posts
    939
    Intrinsic, THANKS!

    I find your function very valuable. Your post/project should be moved the Examples section.

    The only "problem" I noticed is that the file browse dialog is flickering when I start it the second time. I'm not able to use the combo box ("Look in:"), but I resolved this by adding Page.StopTimer() as the first command in Button.On Click.

    Previously I have used a while loop to enumerate windows, but your solution is nicer (but have to keep track of several On Timer functions).

    Code:
    -- wait for system to open the file
    local bHandleFound = false; local nRescueCounter = 0; local sHelpHandle;
    while not bHandleFound and nRescueCounter <= 60 do
    	nRescueCounter = nRescueCounter + 1; -- avoid an infinitive loop!
    	sHelpHandle = Get_hWind(sTitle)
    -- a user defined function with Window.EnumerateTitles()
    	if sHelpHandle then
    		Window.SetOrder(sHelpHandle, HWND_BOTTOM);
    		bHandleFound = true;
    	else
    		Application.Sleep(500);	-- wait 5/10 sec
    	end
    end
    I'll try to extend your function with restriction to the top level folder.

    Thanks for sharing!

Similar Threads

  1. How can I close external Windows Media Player?
    By pierre in forum AutoPlay Media Studio 5.0
    Replies: 10
    Last Post: 01-17-2005, 08:35 AM
  2. INFO: JET and MDAC (Complete) Runtime Notes
    By Desmond in forum Setup Factory 6.0 Knowledge Base
    Replies: 0
    Last Post: 11-28-2003, 08:35 AM
  3. INFO: JET 4.0 SP7-SP8 Runtime Notes
    By Desmond in forum Setup Factory 6.0 Knowledge Base
    Replies: 0
    Last Post: 11-28-2003, 08:34 AM
  4. INFO: Setup Factory and the Windows Installer
    By Support in forum Setup Factory 6.0 Knowledge Base
    Replies: 0
    Last Post: 10-22-2002, 10:38 AM
  5. HOWTO: Install Files to the Windows Directory
    By Support in forum Setup Factory 6.0 Knowledge Base
    Replies: 0
    Last Post: 09-18-2002, 02:33 PM

Posting Permissions

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