Debugging with the Shell
This overview explains how to debug Shell and namespace extension DLLs.
- Running the Shell Under a Debugger
- Running and Testing Shell Extensions on Windows NT
- Unloading the DLL
Running the Shell Under a Debugger
To debug your extension, you need to execute the Shell from the debugger. Follow these steps:
- Load the extension's project into the debugger, but do not run it.
- From the Start menu on the Microsoft Windows taskbar, choose Shut Down.
- Press CTRL+ALT+SHIFT, and click No in the Shut Down Windows dialog box. On Windows 2000, click Cancel instead of No. The Shell is now shut down, but all other applications are still running, including the debugger.
- Set the debugger to run the extension DLL with Explorer.exe from the Windows directory.
- 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 taskbar. Your desktop and taskbar can still be used while you run and test the extensions.
To enable this feature, add the following value to the registry.
For this value to take effect, you must log off and log on again. This setting causes the desktop and taskbar 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.
In addition to 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 (shortcut menu extensions, for example) will be loaded into the nondesktop Explorer.exe process. If this process terminates, the desktop and taskbar 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 its usage count is zero, but only after the DLL has not been used for a period of time. This inactive period might be unacceptably long at times, especially when a Shell extension DLL is being debugged. For operating systems prior to Windows 2000, you can shorten the inactive period by adding the following information to the registry.