LRESULT FullStackOnInitDialog( __in HWND hWnd, __in UINT uMsg, __in WPARAM wp, __in LPARAM lp ) { PDIALOG_OBJECT Object; PFULLSTACK_CONTEXT Context; PTREELIST_OBJECT TreeList; ULONG Number; RECT Rect; HWND hWndCtrl; Object = (PDIALOG_OBJECT)SdkGetObject(hWnd); Context = SdkGetContext(Object, FULLSTACK_CONTEXT); // // Create treelist control // hWndCtrl = GetDlgItem(hWnd, IDC_TREE_FULLSTACK); TreeList = TreeListCreate(hWnd, TRUE, IDC_TREE_FULLSTACK, &Rect, hWnd, FullStackFormatCallback, FULLSTACK_COLUMN_COUNT); // // We need explicitly bind the treelist object to its hwnd // if it's hosted in dialog as custom control. // TreeList->hWnd = hWndCtrl; SdkSetObject(hWndCtrl, TreeList); TreeListCreateControls(TreeList); for(Number = 0; Number < FULLSTACK_COLUMN_COUNT; Number += 1) { TreeListInsertColumn(TreeList, Number, FullStackColumn[Number].Align, FullStackColumn[Number].Width, FullStackColumn[Number].Name); } ASSERT(TreeList->hWnd != NULL); Context->Base.TreeList = TreeList; // // Insert thread list // Object->Scaler = &FullStackScaler; DialogRegisterScaler(Object); FullStackInsertData(Object, Context, TreeList); MoveWindow(hWnd, 0, 0, 680, 600, TRUE); SdkSetMainIcon(hWnd); SdkCenterWindow(hWnd); return TRUE; }
LRESULT MmHeapOnInitDialog( __in HWND hWnd, __in UINT uMsg, __in WPARAM wp, __in LPARAM lp ) { PTREELIST_OBJECT TreeList; PMM_FORM_CONTEXT Context; PDIALOG_OBJECT Object; ULONG Number; RECT Rect; HWND hWndCtrl; ULONG i; LVCOLUMN lvc = {0}; RECT CtrlRect; Object = (PDIALOG_OBJECT)SdkGetObject(hWnd); Context = SdkGetContext(Object, MM_FORM_CONTEXT); // // Create treelist control // GetClientRect(hWnd, &Rect); Rect.right = 10; Rect.bottom = 10; hWndCtrl = GetDlgItem(hWnd, IDC_TREELIST); TreeList = TreeListCreate(hWnd, TRUE, IDC_TREELIST, &Rect, hWnd, MmHeapFormatCallback, MmHeapColumnCount); // // We need explicitly bind the treelist object to its hwnd // if it's hosted in dialog as custom control. // TreeList->hWnd = hWndCtrl; SdkSetObject(hWndCtrl, TreeList); TreeListCreateControls(TreeList); for(Number = 0; Number < MmHeapColumnCount; Number += 1) { TreeListInsertColumn(TreeList, Number, MmHeapColumn[Number].Align, MmHeapColumn[Number].Width, MmHeapColumn[Number].Name ); } ASSERT(TreeList->hWnd != NULL); Context->TreeList = TreeList; // // Initialize splitbar // hWndCtrl = GetDlgItem(hWnd, IDC_SPLIT); SplitSetObject(hWndCtrl, &MmHeapSplitObject); // // Initialize listview // hWndCtrl = GetDlgItem(hWnd, IDC_LIST_BACKTRACE); ListView_SetExtendedListViewStyleEx(hWndCtrl, LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT); for (i = 0; i < 4; i++) { lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; lvc.iSubItem = i; lvc.pszText = MmHeapListColumn[i].Title; lvc.cx = MmHeapListColumn[i].Width; lvc.fmt = MmHeapListColumn[i].Align; ListView_InsertColumn(hWndCtrl, i, &lvc); } // // Position controls // GetClientRect(hWnd, &Rect); hWndCtrl = GetDlgItem(hWnd, IDC_TREELIST); CtrlRect.top = 0; CtrlRect.left = 0; CtrlRect.right = (Rect.right - Rect.left) / 2 - 2; CtrlRect.bottom = Rect.bottom; MoveWindow(hWndCtrl, CtrlRect.left, CtrlRect.top, CtrlRect.right - CtrlRect.left, CtrlRect.bottom - CtrlRect.top, TRUE); hWndCtrl = GetDlgItem(hWnd, IDC_SPLIT); CtrlRect.top = 0; CtrlRect.left = CtrlRect.right; CtrlRect.right = CtrlRect.left + 2; CtrlRect.bottom = Rect.bottom; MoveWindow(hWndCtrl, CtrlRect.left, CtrlRect.top, CtrlRect.right - CtrlRect.left, CtrlRect.bottom - CtrlRect.top, TRUE); hWndCtrl = GetDlgItem(hWnd, IDC_LIST_BACKTRACE); CtrlRect.top = 0; CtrlRect.left = CtrlRect.right; CtrlRect.right = Rect.right; CtrlRect.bottom = Rect.bottom; MoveWindow(hWndCtrl, CtrlRect.left, CtrlRect.top, CtrlRect.right - CtrlRect.left, CtrlRect.bottom - CtrlRect.top, TRUE); // // Register dialog scaler // Object->Scaler = &MmHeapScaler; DialogRegisterScaler(Object); return TRUE; }