Restart explorer.exe shell in C/C++

The easiest way to restart Windows Explorer shell is… sending a TerminateProcess with “2” as exit code.

“pid” is your Process ID. Since explorer.exe may have multiple processes, you’ll need the one who has “Shell_TrayWnd” Window Class name.

Small example:

Easy, right?

5 thoughts on “Restart explorer.exe shell in C/C++”

    • This just for explorer.exe shell.
      Terminate process with 2 tells to the OS (not sure exactly how, but this is how it works when you register explorer.exe as shell) to restart the process

      Reply

Leave a Reply to Peter Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Enable Notifications    OK No thanks