Debugging With the ShellDebugging With the Shell*
*Contents  *Index  *Topic Contents
*Previous Topic: Control Panel Applications
*Next Topic: Dragging and Dropping

Debugging With the Shell


This overview explains how to debug shell and namespace extension DLLs.

arrowy.gifRunning the Shell Under a Debugger

arrowy.gifRunning and Testing Shell Extensions on Windows NT

arrowy.gifUnloading the DLL

Running the Shell Under a Debugger

To debug your extension, you need to execute the shell from the debugger. Follow these steps:

  1. Load the extension's project into the debugger, but do not run it.
  2. From the Start menu on the Microsoft® Windows® taskbar, choose Shut Down.
  3. Press CTRL+ALT+SHIFT, and click No in the Shut Down Windows dialog box. The shell is now shut down, but all other applications are still running, including the debugger.
  4. Set the debugger to run the extension DLL with Explorer.exe from the Windows directory.
  5. Run the project from the debugger. The shell will start up as usual, but the debugger will be attached to the shell's process.

Running and Testing Shell Extensions on Windows NT

You can run and test your Microsoft® Windows NT® extensions in a separate Windows Explorer process to avoid stopping and restarting the desktop and tray. Your desktop and tray can still be used while you run and test the extensions.

To enable this feature, add the following value to the registry.

HKEY_CURRENT_USER\
   Software\
      Microsoft\
         Windows\
            CurrentVersion\
               Explorer\
                  DesktopProcess(REG_DWORD) = 1

For this value to take effect, you must log off and log on again. This setting causes the desktop and tray windows to be created in one Explorer.exe process and all other Explorer and folder windows to be opened in a different Explorer.exe process.

Besides making running and testing your extensions more convenient, this setting also makes the desktop more robust as it relates to shell extensions. Many such extensions (context menu extensions, for example) will be loaded into the nondesktop Explorer.exe process. If this process terminates, the desktop and tray will be unaffected and the next Explorer or folder window will re-create the terminated process.

Unloading the DLL

The shell automatically unloads a DLL when the DLL's usage count is zero, but only after the DLL has not been used for a period of time. This inactive period may be unacceptably long at times, especially when a shell extension DLL is being debugged. You can shorten the inactive period by adding the following information to the registry.

HKLM 
   Software 
      Microsoft 
         Windows 
            CurrentVersion 
               Explorer 
                  AlwaysUnloadDll 

Up Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.