PDA

View Full Version : Window order problem



adivin
10-29-2005, 01:29 AM
when I lounch a program (file run) after a few seconds the window containing that program goes behind AMS window (I use Kiosk - but not "always in top option")??????

yosik
10-29-2005, 11:07 AM
can you post your project so that we can have a look and try to help you?

Yossi

adivin
10-30-2005, 08:02 AM
can you post your project so that we can have a look and try to help you?

Yossi
sorry, no
other solution????

Eagle
10-30-2005, 08:08 AM
does it do the same if you don't use kiosk..just to check it is not something else,perhaps something the launched program is doing..

adivin
10-30-2005, 08:17 AM
does it do the same if you don't use kiosk..just to check it is not something else,perhaps something the launched program is doing..
yes and even if I open a html page with File.OpenURL after the page is loaded the AMS window goes on top...

Eagle
10-30-2005, 08:37 AM
what window mode paramater are you setting for file.run(also waitforreturn true\false) and window mode for file.open. Does seem strange it would be doing this when Not running in kiosk mode. You are of course not doing any
z order coding yourself anywhere ? Any Window 'set mask' stuff ?

adivin
10-30-2005, 12:52 PM
what window mode paramater are you setting for file.run(also waitforreturn true\false) and window mode for file.open. Does seem strange it would be doing this when Not running in kiosk mode. You are of course not doing any
z order coding yourself anywhere ? Any Window 'set mask' stuff ?
no 'set mask' , waitforreturn true\false - I tryed both, window mode paramater - Itryed all

Intrigued
10-30-2005, 03:37 PM
This may help... I am using the .dll I recently compiled, and shared here, to achieve what I believe you need to have done in your project.

Here are the files:

Project (.apz)
http://www.amsuser.com/ams/examples/Z-orderKeepAppOnTop-AMS6-Intrigued.apz

Example (.exe)
http://www.amsuser.com/ams/examples/Z-orderKeepAppOnTop-AMS6-Intrigued.exe

Here is the code chunks from the On Show and On Timer event areas:

On Show

File.Run(_SystemFolder.."\\notepad.exe", "", "", SW_SHOWNORMAL)

Application.Sleep(1000)

dll_ActiveWinHandle = DLL.CallFunction("AutoPlay\\Docs\\DLLActiveWindow.dll", "ACTIVEWINDOWHANDLE", "", DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL)

Page.StartTimer(500)

On Timer

Window.SetOrder(dll_ActiveWinHandle, HWND_TOPMOST)

adivin
10-31-2005, 09:53 AM
This may help... I am using the .dll I recently compiled, and shared here, to achieve what I believe you need to have done in your project.

Here are the files:

Project (.apz)
http://www.amsuser.com/ams/examples/Z-orderKeepAppOnTop-AMS6-Intrigued.apz

Example (.exe)
http://www.amsuser.com/ams/examples/Z-orderKeepAppOnTop-AMS6-Intrigued.exe

Here is the code chunks from the On Show and On Timer event areas:

On Show

File.Run(_SystemFolder.."\\notepad.exe", "", "", SW_SHOWNORMAL)

Application.Sleep(1000)

dll_ActiveWinHandle = DLL.CallFunction("AutoPlay\\Docs\\DLLActiveWindow.dll", "ACTIVEWINDOWHANDLE", "", DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL)

Page.StartTimer(500)

On Timer

Window.SetOrder(dll_ActiveWinHandle, HWND_TOPMOST)
it doesn't work! (only the .exe) but not the .apz: abnormal program termination
and I want to lounch the program by clicking on a Button on page and not on Page.On Show

Intrigued
10-31-2005, 04:16 PM
I just downloaded the file I posted (.apz) and opened it and it works for me. I'm not sure in your case, other than you need to have AMS 6 (not 5) to open such. You may want to reinstalled AMS 6 if you do have it. Just a thought.

And as for the Button... just copy and past the On Show code into the On Click event (area) of said Button object.

:yes

doc13x
06-22-2007, 01:24 PM
:)
Ok - I too have an issue with the AMS Kiosk application popping back in front of the other applications that I am running - but in my case, it is usually because the touch screen has just a scrap of the kiosk menu showing and the user hits it in a moving ambulance (our kiosk program runs on a toughbook in our ambulances).

What I need is a way to get the Kiosk Application to recognize the fact that an application is already running, and simply revert back to that 'open' incidence of the application if the button is pressed again.

Can you help with that?

RizlaUK
06-22-2007, 02:57 PM
Have you tryed useing:

Window.SetOrder(Application.GetWndHandle(), HWND_BOTTOM);

after your filerun command


just a tought


What I need is a way to get the Kiosk Application to recognize the fact that an application is already running, and simply revert back to that 'open' incidence of the application if the button is pressed again.


try this: (example useing notepad)


IsRun = File.IsInUse(_WindowsFolder.."\\NOTEPAD.exe");
if IsRun then
windows = Window.EnumerateTitles();
window_name = "Notepad";
for handle, title in windows do
result = String.Find(title, window_name, 1, false);
if (result ~= -1) then
Window.SetOrder(handle, HWND_TOP);
end
end
else
result = File.Run(_WindowsFolder.."\\NOTEPAD.exe", "", "", SW_SHOWNORMAL, false);
end

RizlaUK
06-22-2007, 03:10 PM
heres the same code in function form (for ease of use)


place this in global functions

function CheckRunningApp(Path, Title)
IsRun = File.IsInUse(Path);
if IsRun then
windows = Window.EnumerateTitles();
for handle, title in windows do
result = String.Find(title, Title, 1, false);
if (result ~= -1) then
Window.SetOrder(handle, HWND_TOP);
end
end
else
result = File.Run(Path, "", "", SW_SHOWNORMAL, false);
end
end

and call the function from your button with the path as the 1st argument and the title as the 2nd, this way if you have more than one app to run you can use the same function

CheckRunningApp(_WindowsFolder.."\\NOTEPAD.exe", "Notepad")

doc13x
06-27-2007, 02:32 PM
Seems to work, but I need to add command line arguments to the executable to enable the GPS option... where do I fit them in? My former button command looked like this:

result = File.Run("C:\\Program Files\\MOH Locator Application\\MOH_Locator.exe", "gps", "", SW_MAXIMIZE, false);

I placed the global variable script on the application and then changed the button to this:

result = CheckRunningApp(_ProgramFilesFolder.."\\MOH Locator Application\\MOH_Locator.exe", "MOH Locator Application")

But I need it to have the "gps" command line argument?

Adam
06-27-2007, 03:28 PM
Also see if you can confirm this on multiple systems. I have had cases like this where it is totally system specific to your development machine.

Just a thought

Adam.

doc13x
06-28-2007, 06:44 AM
I only run this software on a specific system - all builds are exactly the same (they have to fit in a mount in an ambulance). There is no way to test the config out on other systems.

I really need to add "gps" to the command line somehow, though.

doc13x
06-28-2007, 06:59 AM
Also see if you can confirm this on multiple systems. I have had cases like this where it is totally system specific to your development machine.

Just a thought

Adam.

Can't do it - the GPS software is specific to a build on a Panasonic Toughbook that mounts in the ambulance.

doc13x
06-28-2007, 09:31 AM
Seems to work, but I need to add command line arguments to the executable to enable the GPS option... where do I fit them in? My former button command looked like this:

result = File.Run("C:\\Program Files\\MOH Locator Application\\MOH_Locator.exe", "gps", "", SW_MAXIMIZE, false);

I placed the global variable script on the application and then changed the button to this:

result = CheckRunningApp(_ProgramFilesFolder.."\\MOH Locator Application\\MOH_Locator.exe", "MOH Locator Application")

But I need it to have the "gps" command line argument?


_ OK - I added my command line parameter to the global function - then created a second one (different name) for apps without the command line variable which lets me set all my buttons up to bring the apps back to the top. Thank you so much for the help!!