Search code examples
javascriptnode.jsnode-webkitnwjs

How to set NW js Window always in background in kiosk mode


I am running an NW js application in kiosk mode,and i am giving option to launch native windows desktop apps from it, Issue:- After i am launching the child application ,if i click any where in the body of nw js application,the child application window is going background of nwjs window,

Looking for: How to set NWjs window always in background ,if child window opens it should be in foreground until it minimize,

Thank you Sandeep KS


Solution

  • Create a child application with following c# code ,and run that child process from nwjs application

    SetWindowPos can make windows AlwaysOnTop. Most likely it can give the opposite result. Try something along these lines:

    [DllImport("user32.dll")]
    static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X,
       int Y, int cx, int cy, uint uFlags);
    
    
     public const uint SWP_NOSIZE          = 0x0001;
     public const uint SWP_NOMOVE          = 0x0002;
     public const uint SWP_NOACTIVATE      = 0x0010;
     public const int HWND_BOTTOM = 1;
    
    
    SetWindowPos(hWnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE);