Q:

How could i create a TreeView like Microsoft apps

Hi im training to develop an app but i want to add a tree with a specific appearance i succeed  in doing that but the appearance of what i have is not what my clients want the app is developed using MFC and C++.
My app looks like this:

I want it to look like this:

The code I'm using:
CRect rectDummy(0,0,200,600);
//rectDummy.SetRectEmpty();

CTreeCtrl m_wndClassView;

const DWORD dwViewStyle = WS_CHILD | WS_VISIBLE | TVS_HASLINES | TVS_LINESATROOT | TVS_HASBUTTONS | WS_CLIPSIBLINGS | WS_CLIPCHILDREN;

if (!m_wndClassView.Create(dwViewStyle, rectDummy, &m_wndView, 2))
{
    TRACE0("Failed to create Class View\n");
    return -1;      // fail to create
}

HTREEITEM hRoot = m_wndClassView.InsertItem(_T("System Summary"), 0, 0);
m_wndClassView.SetItemState(hRoot, TVIS_BOLD, TVIS_BOLD);

HTREEITEM hClass = m_wndClassView.InsertItem(_T("Hardwre Resources"), 1, 1, hRoot);
hClass = m_wndClassView.InsertItem(_T("Components"), 1, 1, hRoot);
hClass = m_wndClassView.InsertItem(_T("Software Enviroment"), 1, 1, hRoot);

I prefer the solution to be in MFC/C++ if possible and not using a third party libraries.

A:

You need a couple of things to get this look:

Make sure that your application manifest specifies comctl32 v6.
Add a call to SetWindowTheme(hTreeView, L"explorer", NULL) after you create the tree view. Here hTreeView is the window handle of the tree view.

A:

Add dependency to the uxtheme.lib library, include the <Uxtheme.h> header, call the SetWindowTheme() function after you've created the control:
SetWindowTheme(hYourTreeviewHandle, L"Explorer", NULL);

which will give your treeview control a Windows Explorer look and feel. Things are much more involved as you need to supply your own image list and also utilize the TreeView_SetImageList() macro to attach the image lists to the treeview:
TreeView_SetImageList(hYourTreeviewHandle, hYourImagesHandle, TVSIL_NORMAL);

