2011-8-9 19:13:18
来源:互联网 发布:山田凉介 知乎 编辑:程序博客网 时间:2024/05/08 07:39
2011-8-9 19:13:18
void CTraceToolDlg::OnBnClickedRefresh()
{
Cleanup();
m_bDeleting = TRUE;
m_tree.DeleteAllItems();
m_bDeleting = FALSE;
InitVariables();
UpdateData(FALSE);
PopulateTree();
}
在点击刷新按钮后的操作
枚举出所有的树
void CTraceToolDlg::PopulateTree()
{
CArray< DWORD > aidProcesses;
GetProcessIds( aidProcesses );
for( int iProcess = 0; iProcess < aidProcesses.GetSize(); iProcess++ )
{
DWORD idProcess = aidProcesses[iProcess];
DWORD_PTR dwProcess = AtlTraceOpenProcess( idProcess );
if( dwProcess != 0 )
{
AtlTraceSnapshotProcess( dwProcess );
ATLTRACEPROCESSINFO info;
AtlTraceGetProcessInfo( dwProcess, &info );
const int MAX_TEXT_SIZE = 256;
TCHAR szText[MAX_TEXT_SIZE];
USES_CONVERSION_EX;
CW2T pszName(info.szName);
LPTSTR lpszName = pszName;
_sntprintf_s(szText, MAX_TEXT_SIZE, _TRUNCATE, _T( "%s:0x%08x" ), lpszName, idProcess );
szText[MAX_TEXT_SIZE - 1] = 0;
//向树中插入一项
HTREEITEM hProcessItem = m_tree.InsertItem( szText );
PROCESSSETTINGS *pPS = NULL;
pPS = new PROCESSSETTINGS;
pPS->bModified = FALSE;
pPS->dwProcess = dwProcess;
pPS->ps.nLevel = info.settings.nLevel;
pPS->ps.bEnabled = info.settings.bEnabled;
pPS->ps.bFuncAndCategoryNames = info.settings.bFuncAndCategoryNames;
pPS->ps.bFileNameAndLineNo = info.settings.bFileNameAndLineNo;
m_tree.SetItemData( hProcessItem, reinterpret_cast<DWORD_PTR>(pPS) );
//现在还需要遍历一下模块
for( int iModule = 0; iModule < info.nModules; iModule++ )
{
ATLTRACEMODULEINFO module;
AtlTraceGetModuleInfo( dwProcess, iModule, &module );
CW2T pszModuleName(module.szName);
LPTSTR lpszModuleName = pszModuleName;
#ifndef _UNICODE
if(lpszModuleName == NULL)
lpszModuleName = _T("");
#endif
HTREEITEM hModuleItem = m_tree.InsertItem( lpszModuleName, hProcessItem );
DWORD_PTR dwModule = module.dwModule;
TRACESETTINGS *pTS = NULL;
pTS = new TRACESETTINGS;
ENSURE(pTS); /* prefast noise */
pTS->bModified = FALSE;
pTS->dwHandle = dwModule;
pTS->ts.nLevel = module.settings.nLevel;
pTS->ts.eStatus = module.settings.eStatus;
m_tree.SetItemData( hModuleItem, reinterpret_cast<DWORD_PTR>(pTS) );
//遍历模块 模块的所有类别
for( int iCategory = 0; iCategory < module.nCategories; iCategory++ )
{
ATLTRACECATEGORYINFO category;
AtlTraceGetCategoryInfo( dwProcess, dwModule, iCategory, &category );
DWORD_PTR dwCategory = category.dwCategory;
CW2T pszCategoryName(category.szName);
LPTSTR lpszCategoryName = pszCategoryName;
#ifndef _UNICODE
if(lpszCategoryName == NULL)
lpszCategoryName = _T("");
#endif
HTREEITEM hCategoryItem = m_tree.InsertItem( lpszCategoryName, hModuleItem );
TRACESETTINGS *pTS2 = NULL;
pTS2 = new TRACESETTINGS;
ENSURE(pTS2); /* prefast noise */
pTS2->bModified = FALSE;
pTS2->dwHandle = dwCategory;
pTS2->ts.nLevel = category.settings.nLevel;
pTS2->ts.eStatus = category.settings.eStatus;
m_tree.SetItemData( hCategoryItem, reinterpret_cast<DWORD_PTR>(pTS2) );
}
}
}
}
}
race.cpp(348) : WinMsg: PumpMessage: hwnd=0x000504C0, msg = WM_PAINT (0x00000000, 0x00000000)
afxtrace.cpp(348) : WinMsg: PumpMessage: hwnd=0x000504C0, msg = WM_PAINT (0x00000000, 0x00000000)
afxtrace.cpp(348) : WinMsg: PumpMessage: hwnd=0x000504C0, msg = WM_TIMER (0x00000001, 0x00000000)
afxtrace.cpp(348) : WinMsg: PumpMessage: hwnd=0x00460DEE, msg = WM_TIMER (0x00000002, 0x00000000)
afxtrace.cpp(348) : WinMsg: PumpMessage: hwnd=0x00460DEE, msg = WM_PAINT (0x00000000, 0x00000000)
afxtrace.cpp(360) : WinMsg: WndProc: hwnd=0x000504B4, msg = 0x0000 (0x00000000, 0x00000000)
afxtrace.cpp(348) : WinMsg: PumpMessage: hwnd=0x000504C0, msg = WM_PAINT (0x00000000, 0x00000000)
afxtrace.cpp(348) : WinMsg: PumpMessage: hwnd=0x000504C0, msg = WM_PAINT (0x00000000, 0x00000000)
- 2011-8-9 19:13:18
- 2011-9-19 18:33:09
- 2011-9-18 13:46:09
- 2011-8-13 1:18:23
- 2011-9-8 19:37:43
- 8/18/2011 9:39:53 AM
- 2011-8-9 13:30:36
- 2011-8-9 15:13:00
- 2011-5-19至2011-9-8小知识点日志
- 2011-9-19
- 2011-9-18 sax
- 13/8/18 周赛
- 2011-8-9
- 2011-9-19 9:54:52
- 2011-9-13 函数总结
- 2016/9/13,18:38
- 2011-05-13 19:07:10
- 2011-7-19 13:37:29
- testPython
- php汉字乱码的一些解决方案
- jstl学习2
- Visual Studio一些小技巧
- HDU 3911
- 2011-8-9 19:13:18
- Python学习(一)——学习资源记录
- 子衿的事(41)
- java删除一个目录下面的所有文件
- flex 中 mx.controls.image 的 addChild 问题
- 技巧:Vimdiff 使用
- 迷宫——1.00
- IAR调试S3C6410的笔记(一)
- C显示时间版本