描述:
shell扩展com(IContextMenu的com)怎么调试?
我写好了一个shell扩展com(IContextMenu的com,debug版),并注册成功。
我在setting | debug | 可执行调试对话中输入explorer.exe(资源管理器),
然后在com源程序中设置断点,开始调试,出现错误:
explorer.exe(资源管理器)无调试信息。(explorer.exe肯定是release版的)
结果无法调试, 怎么办?
解决方案1:
看这篇文章。
写得比较详细。
要先把explorer做掉。
http://www.hrbust.edu.cn/xstd/students/cahust/ketang/zhuanye/zy3.htm
Debugging with the Shell
--------------------------------------------------------------------------------
This overview explains how to debug Shell and namespace extension dynamic-link libraries (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.
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 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 recreate 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.
HKEY_LOCAL_MACHINE
Software
Microsoft
Windows
CurrentVersion
Explorer
AlwaysUnloadDll