1、cmd命令
wmic process where "ExecutablePath like 'C:\\Wind\\Dragon\\bin\\%%'" delete
可以杀死指定目录下的所有运行的进程
在VS中可以将它放在生成事件中,方便调试
2、DLL中控件美化
在DLL工程的stdafx.h头文件最后加上如下代码即可,注意字符集类型:
#ifdef _UNICODE
#if defined _M_IX86
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_IA64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_X64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#else
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#endif
#endif
注意如下这一行
#endif // !defined(AFX_STDAFX_H__3A0AFA76_2723_4578_866B_0A1980C22EA7__INCLUDED_)
3、WinDbg调试不同位数的dump文件(如何用windbg分析64位机上32位程序的dump文件)
将dump拖入到windbg中后,在command输入栏输入 .load wow64exts 回车 !sw 回车,就将windbg的dump,从64位模式切换到了32位模式,否则看到的call stack 对我们分析dump是没有帮助的。然后就可以使用其它的命令来分析了。比如:使用kb命令,查看所有线程的调用堆栈,找出出错的线程,~*kb,就是查看所有线程的调用堆栈。
4、WinDbg常用命令
~*kv :显示所有线程堆栈,也可以选择call stack和Threads,然后可以选中线程看具体线程堆栈
!locks [Options] [Address]
- Options
- Specifies the amount of information to be displayed. Any combination of the following options can be used:
- -v
- Displays detailed information about each lock. -p
- Display all available information about the locks, including performance statistics. -d
- Display information about all locks. Otherwise, only locks with contention are displayed.)
The dt command displays information about a local variable, global variable or data type. This can display information about simple data types, as well as structures and unions.
!cs 扩展显示一个或多个临界区(critical section)或者整个临界区树
!cs Address 指定要显示的临界区地址。如果省略该参数,调试器显示当前进程中所有临界区。