Ejemplo n.º 1
0
BOOL CDirTreeCtrl::DisplayTree(LPCTSTR strRoot, BOOL bFiles)
{
	DWORD dwStyle = GetStyle();   // read the windowstyle
	if ( dwStyle & TVS_EDITLABELS ) 
	{
		// Don't allow the user to edit ItemLabels
		ModifyStyle( TVS_EDITLABELS , 0 );
	}
	
	// Display the DirTree with the Rootname e.g. C:\
	// if Rootname == NULL then Display all Drives on this PC
    // First, we need the system-ImageList
	
	DeleteAllItems();

	if ( !GetSysImgList() )
		return FALSE;
    m_bFiles = bFiles;  // if TRUE, Display Path- and Filenames 
	if ( strRoot == NULL || strRoot[0] == '\0' )
	{
		if ( !DisplayDrives() )
			return FALSE;
		m_strRoot = _T("");
	}
    else
	{
		m_strRoot = strRoot;
		if ( m_strRoot.Right(1) != '\\' )
			m_strRoot += _T("\\");
		HTREEITEM hParent = AddItem( TVI_ROOT, m_strRoot );
		DisplayPath( hParent, strRoot );
	}
	return TRUE;	
}
void CProcessView::OnInitialUpdate() 
{
	CListView::OnInitialUpdate();
	
	// TODO: Add your specialized code here and/or call the base class
		CListCtrl& lc = GetListCtrl();
	//lc.ModifyStyle(0,LVS_REPORT);
    lc.ModifyStyle(0,/*LVS_ICON*/LVS_REPORT|LVS_SINGLESEL|LVM_SORTITEMS); 
	lc.SetExtendedStyle(LVS_EX_TRACKSELECT | LVS_EX_ONECLICKACTIVATE);



	lc.InsertColumn(0, _T("Process Name"), LVCFMT_LEFT);
	lc.InsertColumn(1, _T("PID"), LVCFMT_LEFT);
	lc.SetColumnWidth(0,200);
	lc.SetColumnWidth(1,55);

	GetSysImgList();
}