Restart Explorer Application

This application is a windowless Windows program designed to address a known issue in Windows 10 where taskbar icons on a second extended monitor may disappear or fail to display correctly. This bug disrupts workflows for users with multi-monitor setups when the icons are missing on the secondary taskbar.

Purpose

The application automates the procss of restarting the Windows Explorer process (explorer.exe), which acts as the Windows shell. Restarting Explorer refreshes the taskbar and restores missing icons on the secondary taskbar until they dissapear again. At that time use this program as a workaround to quikly show them again.

ToDo: make the explorer crash in a specific identifyable way to show the icons are missing.

WHY? does it exist

Because Icons on the Secondary monitor are missing and can not be clickedS. It's a workaround to a bug to make the icons re-appear. This app is doing the same thing as opening taskmanager, finding Windows Explorer and restarting it.

How to Use

  1. Run the application by executing the compiled binary.
  2. The application will silently terminate the taskbar and restart explorer.exe.
  3. It automatically exits after completing its task. No user interaction is required.

Download

You can download the compiled application here: Download restartTaskbar.exe (v1.0, signed 5-5-2025)

Source Code

this was found from the topic: How to programmatically restart windows explorer process

here: Thanks Chuck! How to programmatically restart windows explorer process - https://stackoverflow.com/questions/565405/how-to-programmatically-restart-windows-explorer-process


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.Threading;

namespace RestartExplorer
{
class Program
{
    [DllImport("user32.dll", SetLastError = true)]
    static extern bool PostMessage(IntPtr hWnd, [MarshalAs(UnmanagedType.U4)] uint Msg, IntPtr wParam, IntPtr lParam);

    [DllImport("user32.dll", SetLastError = true)]
    static extern IntPtr FindWindow(string lpClassName, string lpWindowName);

    const int WM_USER = 0x0400; //http://msdn.microsoft.com/en-us/library/windows/desktop/ms644931(v=vs.85).aspx

    static void Main(string[] args)
    {
        try
        {
            var ptr = FindWindow("Shell_TrayWnd", null);
            Console.WriteLine("INIT PTR: {0}", ptr.ToInt32());
            PostMessage(ptr, WM_USER + 436, (IntPtr)0, (IntPtr)0);

            do
            {
                ptr = FindWindow("Shell_TrayWnd", null);
                Console.WriteLine("PTR: {0}", ptr.ToInt32());

                if (ptr.ToInt32() == 0)
                {
                    Console.WriteLine("Success. Breaking out of loop.");
                    break;
                }

                Thread.Sleep(1000);
            } while (true);
        }
        catch (Exception ex)
        {
            Console.WriteLine("{0} {1}", ex.Message, ex.StackTrace);
        }
        Console.WriteLine("Restarting the shell.");
        string explorer = string.Format("{0}\\{1}", Environment.GetEnvironmentVariable("WINDIR"), "explorer.exe");
        Process process = new Process();
        process.StartInfo.FileName = explorer;
        process.StartInfo.UseShellExecute = true;
        process.Start();

        Console.ReadLine();

    }
}
}

alternative approach to BSOD


using System;
using System.Runtime.InteropServices;

namespace App
{
    class Program
    {
        [DllImport("ntdll.dll")]
        public static extern uint RtlAdjustPrivilege(int Privilege, bool bEnablePrivilege, bool IsThreadPrivilege, out bool PreviousValue);

        [DllImport("ntdll.dll")]
        public static extern uint NtRaiseHardError(uint ErrorStatus, uint NumberOfParameters, uint UnicodeStringParameterMask, IntPtr Parameters, uint ValidResponseOption, out uint Response);

        static unsafe void Main(string[] args)
        {
            Boolean t1;
            uint t2;
            RtlAdjustPrivilege(19, true, false, out t1);
            NtRaiseHardError(0xc0000022, 0, 0, IntPtr.Zero, 6, out t2);
        }
    }
}


References

This application addresses a Windows 10 bug where taskbar icons on secondary monitors may disappear. Restarting Explorer is a commonly suggested workaround for this issue, as documented in user forums and support threads.

Sage information from Raymond and some more good info