How to Restart the Windows Shell Programmatically

Last reviewed: October 2, 1995
Article ID: Q137572
The information in this article applies to:
  • Microsoft Win32 Software Development Kit (SDK) version 4.0

SUMMARY

Creating and updating shell extensions in Windows requires that the shell be restarted. This may be accomplished by having the user manually perform this task; however, in many cases, you may find it is better to do it programmatically.

MORE INFORMATION

To restart the shell programmatically, find the shell window, post it a quit message, and then call WinExec() with explorer.exe. For Example:

   HWND hwndShell = FindWindow("Progman", NULL);
   PostMessage(hwndShell, WM_QUIT, 0, 0L);
   WinExec("Explorer.exe",SW_SHOW);


Additional reference words: 4.00 Windows 95
KBCategory: kbprg kbcode
KBSubcategory: UsrShell


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: October 2, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.