How to run power toy in hidden window?

Yen Dang 20 Reputation points
2024-06-13T20:26:36.28+00:00

Dim p = New Process()

p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden

p.StartInfo.CreateNoWindow = True

p.Start("C:\Program Files\PowerToys\WinUI3Apps\PowerToys.Settings.exe")

After running this code, the setup window still appears.

Is there a way to run program quiet without using Find then ShowWindow(SW_HIDE)?

I want to avoid window flickering.

Thanks you!

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,572 questions
VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,642 questions
0 comments No comments
{count} votes

Accepted answer
  1. Castorix31 82,751 Reputation points
    2024-06-14T06:56:59.14+00:00

    The main executable is PowerToys.exe, in *C:\Program Files\PowerToys*

    It is launched as icon in System Tray (only displays the Settings dlg if already running)

    (at least with the last 0.81.1 version)

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Jiachen Li-MSFT 28,076 Reputation points Microsoft Vendor
    2024-06-14T09:02:46.0133333+00:00

    Hi @Yen Dang ,

    If the UseShellExecute property is true or the UserName and Password properties are not null, the CreateNoWindow property value is ignored and a new window is created.

    So you need to set p.StartInfo.UseShellExecute = False

    Best Regards.

    Jiachen Li


    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments