Announcement

Collapse
No announcement yet.

Help With Making An Application Awalys Active / on focus

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • telco
    replied
    To fixed this issue is to run a timer and perform a mouse click on specific screen location.

    Leave a comment:


  • HLBterence
    replied
    Ulrich, we still do not have a working solution. Thank you for your support.

    Leave a comment:


  • Ulrich
    replied
    Try this:
    Code:
    function ResetApplicationFocus()
    	nRes = String.ToNumber(DLL.CallFunction(_SystemFolder .. "\\User32.dll", "GetActiveWindow", 0, DLL_RETURN_TYPE_LONG, DLL_CALL_CDECL));
    	nWnd = Application.GetWndHandle();
    		
    	if (nRes ~= nWnd) then
    		-- set current window on top and reactivate
    		Window.SetOrder(nWnd, HWND_TOPMOST);
    		DLL.CallFunction(_SystemFolder .. "\\User32.dll", "SetForegroundWindow", nWnd, DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL);
    		Page.SetFocus("INPUT_BARCODE");
    	end
    end
    Ulrich

    Leave a comment:


  • HLBterence
    replied
    Sample application

    Here is a sample application. When the application loss focus the first it kicks back very well, but after that it does not set the focus to the input field
    Attached Files

    Leave a comment:


  • HLBterence
    replied
    I will upload a sample application. This does not produce an expected outcome.

    Leave a comment:


  • Ulrich
    replied
    You could use Page.SetFocus() to move the focus to the desired control when the window became inactive.

    Ulrich

    Leave a comment:


  • HLBterence
    replied
    Ulrich, we have a new problem with the proposed solution.

    Our proposed approach finds an input field that is always on focus for bar code reading on scan, yet our proposed solution does not restore this focus when the application is restored to it's required top order
    (
    Window.SetOrder(nWnd, HWND_TOPMOST);c
    ) Any thoughts on that ?

    Leave a comment:


  • Ulrich
    replied
    You are welcome.

    Ulrich

    Leave a comment:


  • HLBterence
    replied
    Originally posted by Ulrich View Post
    One possible way to make sure your application window is always on top and active is this:

    At the end of your On Show event script, start a timer, which is triggered every few seconds. Five seconds should be fast enough to make the application return quickly, like this:

    Code:
    Page.StartTimer(5000);
    Now, in the On Timer event script, place this:

    Code:
    nRes = String.ToNumber(DLL.CallFunction(_SystemFolder .. "\\User32.dll", "GetActiveWindow", "0", DLL_RETURN_TYPE_LONG, DLL_CALL_CDECL));
    nWnd = Application.GetWndHandle();
    
    if (nRes ~= nWnd) then
       -- set current window on top and reactivate
       Window.SetOrder(nWnd, HWND_TOPMOST);
    end
    Ulrich

    This solves my problem. Maybe it's time indigorose help us with more knowledge on how to extend AMS applications with windows dll.

    Leave a comment:


  • Ulrich
    replied
    One possible way to make sure your application window is always on top and active is this:

    At the end of your On Show event script, start a timer, which is triggered every few seconds. Five seconds should be fast enough to make the application return quickly, like this:

    Code:
    Page.StartTimer(5000);
    Now, in the On Timer event script, place this:

    Code:
    nRes = String.ToNumber(DLL.CallFunction(_SystemFolder .. "\\User32.dll", "GetActiveWindow", "0", DLL_RETURN_TYPE_LONG, DLL_CALL_CDECL));
    nWnd = Application.GetWndHandle();
    
    if (nRes ~= nWnd) then
       -- set current window on top and reactivate
       Window.SetOrder(nWnd, HWND_TOPMOST);
    end
    Ulrich

    Leave a comment:


  • Help With Making An Application Awalys Active / on focus

    Am working on a Point Of Sale application that have to be active (ALWAYS ON FOCUS) at all times until intentionally closed. As of now, it does happen that the application is not always on focus, either because windows popped-up a notification update or i clicked the task bar unintentionally resulting in focus switching to that particular windows. Is there a way of insuring that at all times the application is not only ALWAYS on top BUT also always active because computers that would be running this POS application won’t be having a mouse to keep on switching focus? Thank you.
Working...
X