Add new comment

CM is nil because: GetUIObjectOf should be called from the parent directory IShellFolder interface (in your situation from the parent of the parent directory interface) but you are calling it from the same directory.
I think the easiest solution in this case is to call ShowSysPopup with the parent directory in the lStringList: if Treelist is not empty add files to lStringList and call ShowSysPopup but if Treelist is empty add the parent directory to the lStringList and call ShowSysPopup.