I haven’t looked at WFS in a long time, but if you get a memoryblock from FindFirstFile / FindNextFile (which if I remember is what WFS uses), the directory flag is in the first 4 bytes:
// mb is the memoryblock returned from the API
if (mb.Long(0) and 16) = 16 then
// it's a directory
else
// it's a file
end
I happened to read something about WinForms TreeView weeks ago. I am wondering many similar questions in the XOJO treeview. This is a good thread with interesting discussions.