Как загрузить в TreeView содержимое, например, диска С:\?

FindFirstFile
FindNextFile
FindClose

А вообще самый лёгкий способ получить список файлов создать простой ListBox и отправить ему сообщение LB_DIR.
Примерно так:

SendMessage(hwndLB, LB_DIR, DDL_READWRITE | DDL_DIRECTORY, (LONG)"C:\\*.*");

а затем
цитата:
Adding Tree-View Items
You add an item to a tree-view control by sending the TVM_INSERTITEM message to the control. The message includes the address of a TVINSERTSTRUCT structure, specifying the parent item, the item after which the new item is inserted, and a TVITEM structure that defines the attributes of the item. The attributes include the item's label, its selected and nonselected images, and a application-defined value.

The example in this section demonstrates how to create a table of contents based on the information in a text file. The example includes two functions. The first function searches a file for headings. When it finds one, it extracts the text of the heading and the value that indicates the level of the heading and then passes them to the second function.

The second function adds an item to a tree-view control, using the heading text as the item's label and the heading level to determine the parent item for the new item. A level one heading is added to the root of the tree-view control, a level two heading is added as a child item of the previous level one item, and so on. The function assigns an image to an item based on whether it has any child items. If an item has child items, it gets an image representing a closed folder. Otherwise, it gets an image representing a document. An item uses the same image for both the selected and nonselected states.

// InitTreeViewItems - extracts headings from the specified file and
// passes them to a function that adds them to a tree-view control.
// Returns TRUE if successful, or FALSE otherwise.
// hwndTV - handle to the tree-view control.
// lpszFileName - name of file with headings.

BOOL InitTreeViewItems(HWND hwndTV, LPSTR lpszFileName)
{
HANDLE hf; // handle to file
char szItemText[128]; // label text of tree-view item
int nLevel; // heading level

// Open the file to parse.
if ((hf = CreateFile(lpszFileName, GENERIC_READ,
FILE_SHARE_READ, (LPSECURITY_ATTRIBUTES) NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,
(HANDLE) NULL)) == (HANDLE) INVALID_HANDLE_VALUE)
return FALSE;

// Call private function to parse the file looking for headings.
while ( GetNextHeadingAndLevelFromFile(hf, szItemText, &nLevel) )
// Add the item to the tree-view control.
AddItemToTree(hwndTV, szItemText, nLevel);

return TRUE;
}

// AddItemToTree - adds items to a tree-view control.
// Returns the handle to the newly added item.
// hwndTV - handle to the tree-view control.
// lpszItem - text of the item to add.
// nLevel - level at which to add the item.

HTREEITEM AddItemToTree(HWND hwndTV, LPSTR lpszItem, int nLevel)
{
TVITEM tvi;
TVINSERTSTRUCT tvins;
static HTREEITEM hPrev = (HTREEITEM) TVI_FIRST;
static HTREEITEM hPrevRootItem = NULL;
static HTREEITEM hPrevLev2Item = NULL;
HTREEITEM hti;

tvi.mask = TVIF_TEXT | TVIF_IMAGE
| TVIF_SELECTEDIMAGE | TVIF_PARAM;

// Set the text of the item.
tvi.pszText = lpszItem;
tvi.cchTextMax = lstrlen(lpszItem);

// Assume the item is not a parent item, so give it a
// document image.
tvi.iImage = g_nDocument;
tvi.iSelectedImage = g_nDocument;

// Save the heading level in the item's application-defined
// data area.
tvi.lParam = (LPARAM) nLevel;

tvins.item = tvi;
tvins.hInsertAfter = hPrev;

// Set the parent item based on the specified level.
if (nLevel == 1)
tvins.hParent = TVI_ROOT;
else if (nLevel == 2)
tvins.hParent = hPrevRootItem;
else
tvins.hParent = hPrevLev2Item;

// Add the item to the tree-view control.
hPrev = (HTREEITEM) SendMessage(hwndTV, TVM_INSERTITEM, 0,
(LPARAM) (LPTVINSERTSTRUCT) &tvins);

// Save the handle to the item.
if (nLevel == 1)
hPrevRootItem = hPrev;
else if (nLevel == 2)
hPrevLev2Item = hPrev;

// The new item is a child item. Give the parent item a
// closed folder bitmap to indicate it now has child items.
if (nLevel > 1) {
hti = TreeView_GetParent(hwndTV, hPrev);
tvi.mask = TVIF_IMAGE | TVIF_SELECTEDIMAGE;
tvi.hItem = hti;
tvi.iImage = g_nClosed;
tvi.iSelectedImage = g_nClosed;
TreeView_SetItem(hwndTV, &tvi);
}

return hPrev;
А если тебе нужно полное подобие Explorer'ности, т.е. не только C:\ но и такие приятные вещички как Network Negihbourhood, Printers и прочие папки (и их содержимое) которые не являются файлами, то стоит посмотреть MSDN: Enumerating Items in the Shell (там как раз пример с Tree View +List View). Cм. в \Books\Progamming Windows 95 User Interface\Part 3\Chapter Fourteen
А если это все на Delphi, то там есть пример в Demos\VirtualListView\
А что делает (LONG)"C:\\*.*"? А то я в си не очень.
Кто знает че там в Дельфях надо написать?
Примерно так:
mask := '*.*';
SendMessage(hwnd, LB_DIR, DDL_READWRITE or DDL_DIRECTORY, integer(mask));

TopList Rambler's Top100