Some of you had trouble like this, but search didn't give me much clue as to what's going on.
I've implemented a TreeView and it worked, well, kind of fine, except it never felt the keypress of Enter on an unexpandable node. In the meantime I've installed VFP6 beta, and got an unwanted present of a new TreeView control. I've done what's already been recommended here - copied the class to a tmp.vcx, deleted the old treeview object, inserted a new one, copied all the methods and properties, replaced all references to This with This.Object (and the imagelist with imagelist.object) - and it crashes when it says
this.object.nodeclick(this.object.selectednode)
saying "OLE error code 0x80020006: Unknown name.". When I try to look at it in the debugger's Locals window, a click on treeview.object.selectednode, or treeview.object.nodes, it immediately GPFs. This happens only when I reference the treeview.object.selectednode from a KeyUp event; clicking on nodes works just fine.
Another thing - I've used the MouseMove to detect a node so I can refresh one label below the treeview (used instead of ToolTip) and it works just fine, except the HitTest returns some number (like 1,3242345e38) instead of object reference or .null. - now that's compatibility, isn't it :)
OTOH, this version of TreeView doesn't misbehave on the KeyPress anymore - it recognizes the Enter correctly now.
[later]
OK, I've solved one of these - instead of "this.object.nodeclick(this.object.selectednode)", it should be "this.nodeclick(this.object.selectednode)". Kind of inconsistent, eh? Nevertheless, all the other bugs still move their legs.