Example in FolderItem.Remove (DeleteEntireFolder) the contents doesn't remove everything

This is on Windows 10 with current updates.
I am having a problem with DeleteEntireFolder. It used to delete all of the folders and files. It now only deletes files.
It seems to delete all of the folders, gets to the root folder (in code is theFolder) and it fails with an error code of 145, or contents not empty.

I then check in Windows Explorer and it is empty, but only for a minute or two.

In another minute or two the inner folders are returned.

The code is here is at the end of the example.

[code]If returnCode = 0 Then
// We‘re done without error, so the folder should be empty and we can delete it.
returnCode = theFolder.LastErrorCode
End If

Return returnCode[/code]

I suspect Dropbox is in the play. What is your path ?

Sorry. I do HAVE Dropbox but it’s not in the path.
This is strictly on a C Drive.

I do have an explanation for the inner folders re-appearing. I haven’t figured out how to isolate something in the activate event.
But I don’t have one for the folder not being deleted.

Put the code in a brand new project to isolate it then run and check what is done…

I was away from my computer, but ran this when I got home.
I ran the segment that runs deleted the folder, and didn’t get error 145, but I got this system message.
Note that I don’t use the registry, so I’m not sure how I got the message.

You got this message because the system is unable to display the location, most probably because your code deleted it. For example you can have this message if, in Windows Explorer, you display the content of folder1, go to another folder (folder2), next your code delete folder1 and finally, in Windows Explorer, you press the forward button (to go back to folder1, that doesn’t exist anymore).

Sorry for the last piece.
My own reason for the very last error message, I try to monitor it in Windows Explorer and have the folder as being the focus, and it’s emptiness is on the right. Just like expecting the folderitem I’m monitoring to not crash the system.

I think I understand a little about why the first REMOVE failed with the very last FolderItem.

I had a MessageBox without having a window it was attached to.
The messagebox was called by App, but I eliminated the code and the REMOVE section works and some other code works.
I had just closed a window, and code was running even though the next window wasn’t open and the MessageBox was called for.
I think that is the problem because, Elsewhere, in order to get a DialogBox to work, I have make it a ModalDialogWithin and have to pass the window. If I didn’t, the system would freeze.

They updated the LR for MessageBox and MsgBox.

This line was not in previous (year??) versions.

I was very frustrated with my MsgBoxes, because I could not tell if it needed a window or not. It would really screw things up when one fired and there was no window above a module, for instance.

I had figured out with MessageDialog that it needed ShowModalWithin to function properly if being run from a module.