I use this code to list processes:
//Creating ListBox
hPNList=CreateWindow(TEXT("ListBox"),TEXT(""),WS_CHILD|WS_VISIBLE|LBS_SORT|LBS_NOTIFY,30,132,185,380,hWnd,(HMENU)PNLIST_ID,
GetModuleHandle(NULL),NULL);
//changing Font
SendMessage( hPNList ,WM_SETFONT ,(WPARAM) GetStockObject(DEFAULT_GUI_FONT ),TRUE);
//making list
ProcessCount =getprocesslist(pro);
//adding to list
for ( i = 0; i < ProcessCount; i++)
{
int pos = (int)SendMessage(hPNList, LB_ADDSTRING, 0,
(LPARAM) pro[i].szExeFile);
// Set the array index of the player as item data.
// This enables us to retrieve the item from the array
// even after the items are sorted by the list box.
SendMessage(hPNList, LB_SETITEMDATA, pos, (LPARAM) pro[i].th32ProcessID );
}
Now I want to show that in a tree style.Can anybody help me how to do it?
See Using Tree-View Controls for a general overview of how to work with the native tree view controls in Windows. In particular, see How to Add Tree-View Items for code examples on how to add a hierarchy of items to a tree view.
It boils down to:
CreateWindowfunction while specifyingWC_TREEVIEWas the window classTVM_INSERTITEMmessage to the tree window to populate it with tree items.