locked
Powershell Form to Stay in Background RRS feed

  • General discussion

  • Im working on a PowerShell form that I am compiling to replace explorer as the computer's shell. It seems to be working correctly with my own start menu only containing and launching the software allowed by the company. The issue im having is that when they click on my start menu it brings the form to the foreground and makes all the windows go to back. How can I force my powershell form to stay in the background even when clicked on?
    • Edited by J E Martinez Wednesday, February 1, 2017 5:08 PM
    • Changed type Bill_Stewart Monday, March 6, 2017 7:28 PM
    • Moved by Bill_Stewart Monday, March 6, 2017 7:29 PM Unanswerable
    Wednesday, February 1, 2017 5:08 PM

All replies

  • You really can't.  You would have to replace the desktop with your form.

    To manage available apps in Windows we would use Software restriction policies and a custom start menu.  You can also use Visual Studio to create a custom desktop to replace the standard Windows desktop and do anything you want.  This just isn't possible to do with a script and it is counter to the Windows design.

    There are also numerous third party replacements for the desktop that allow customization. HP delivers one really nice one with HP desktop consumer PCs.

    The basic rule in Windows is that you cannot hide the desktop you can only replace it.


    \_(ツ)_/


    • Edited by jrv Wednesday, February 1, 2017 5:56 PM
    Wednesday, February 1, 2017 5:55 PM
  • How can I force my powershell form to stay in the background even when clicked on?

    To add to what jrv said, we can use the "what if this were possible?" thought experiment.

    This blog posting illustrates what I mean.

    The Old New Thing: How do I create a topmost window that is never covered by other topmost windows?


    -- Bill Stewart [Bill_Stewart]

    Wednesday, February 1, 2017 6:00 PM
  • I'm already replacing the shell with my windows form under the registry winlogon I replaced the shell string with my explorer.exe and it works great. My only question is How can I make it where my explorer.exe stays in the background when clicked on. Its simply a powershell form that I complied to .exe

    https://drive.google.com/file/d/0Bx2a3QpaAAkYWGNWaE9manN6OEU/view?usp=sharing

    Here is a bare bone example of my explorer.exe you can open powershell but then when you click start powershell goes to the background. I would like my form to stay in the background.

    • Edited by J E Martinez Wednesday, February 1, 2017 10:22 PM
    Wednesday, February 1, 2017 10:17 PM
  • Bill what I'm looking for is how to create a BACK MOST. Which is the complete opposite of the post you linked.
    Wednesday, February 1, 2017 10:25 PM
  • I'm already replacing the shell with my windows form under the registry winlogon I replaced the shell string with my explorer.exe and it works great. My only question is How can I make it where my explorer.exe stays in the background when clicked on. Its simply a powershell form that I complied to .exe

    https://drive.google.com/file/d/0Bx2a3QpaAAkYWGNWaE9manN6OEU/view?usp=sharing

    Here is a bare bone example of my explorer.exe you can open powershell but then when you click start powershell goes to the background. I would like my form to stay in the background.

    If you are trying too use a custom explorer.exe then this is the wrong forum.  This forum is for scripts.

    In any case you have not created a desktop which standard "Explorer.exe" does so you are getting a default empty desktop which is the only window that can be always on the bottom.  All other forms compete for topmost and the other positions in the stack are managed by windows.

    Post in the Visual Studio forum for help with custom EXEs. 


    \_(ツ)_/

    Wednesday, February 1, 2017 10:31 PM
  • Bill what I'm looking for is how to create a BACK MOST. Which is the complete opposite of the post you linked.

    Same problem. What if two programs try to do it?

    But in any case, I don't think this is the right place to be asking your question.


    -- Bill Stewart [Bill_Stewart]

    Wednesday, February 1, 2017 10:48 PM
  • What about this... If from powershell I was to call paint:

    start-process C:\WINDOWS\system32\mspaint.exe

    Is there a way to launch it from powershell with the TOPMOST flag on? I'm not worried if another app does the same thing that would be 100 percent acceptable.


    • Edited by J E Martinez Wednesday, February 1, 2017 11:08 PM
    Wednesday, February 1, 2017 11:08 PM
  • Doesn't matter.  If all windows are topmost then they will just move around.

    The way task manger does this is because it is a child of the desktop and use a different "topmost" method call into the lower level API so it can force itself to the top.   There is no equivalent "make me the bottom-most"  Event Explorer cannot make itself stay on the bottom.

    If you create the desktop then you can set the "Z" order of Windows and enforce it.  Also if you crate the desktop you can create it as an application that is like Explorer or any other thing yuo want.  It does not have to look like a Windows desktop.  After all. the desktop is just a Window registered as a desktop.


    \_(ツ)_/

    Wednesday, February 1, 2017 11:17 PM
  • Wednesday, February 1, 2017 11:21 PM
  • Again, I'm ok with all windows being topmost.

    Question: can I launch a program from powershell as topmost?

    Wednesday, February 1, 2017 11:28 PM