You need to wrap the treeview gadget with TreeViewRoot() for root nodes:
SuperStrict Import Maxgui.drivers Local MyWindow:TGadget=CreateWindow("TreeView Example", 40,40,400,400) Global MyTreeView:TGadget=CreateTreeView(5,0,200,360,MyWindow) Local files:String[]=LoadDir(BlitzMaxPath()) Local File:String For file = EachIn files AddTreeViewNode(file, TreeViewRoot(MyTreeView)) Print "file added" Next Repeat WaitEvent() Select EventID() Case EVENT_WINDOWCLOSE End End Select Forever End