Displaying Folder Icons in an XP TreeView Control
{
HWND hwndTV;
hwndTV = CreateWindowEx(WS_EX_CLIENTEDGE,WC_TREEVIEW,g_wszNull,
WS_CHILD|TVS_HASLINES|TVS_LINESATROOT|TVS_HASBUTTONS |WS_VISIBLE,
10,10,300,300,hWnd,(HMENU)98,g_hInst,0);
hil = ImageList_Create(16,16,ILC_COLOR32,10,10);
HICON hi;
HMODULE hmod = LoadLibraryA("shell32");
hi = LoadIcon(hmod,MAKEINTRESOURCE(4)); // closed folder
ImageList_AddIcon(hil,hi);
hi = LoadIcon(hmod,MAKEINTRESOURCE(5)); // open folder
ImageList_AddIcon(hil,hi);
TreeView_SetImageList(hwndTV,hil,TVSIL_NORMAL);
FreeLibrary(hmod);
}
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="x86"
name="foo.bar.YourApp"
type="win32"
/>
<description>YourApp description</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>