Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

MOVE anomaly

May
12,845
164
I just did this.
Code:
c:\users\vefatica\desktop> move Windows6.1-KB2670838-x86.msu \\lucky\c$\Users\vefatica\Desktop\
The MOVE succeeded, but the file's icon remained on the local desktop. That's unusual. I'm accustomed to seeing Explorer update folder views when TCC deletes or copies files. Is MOVE different?
 
This doesn't have anything to do with TCC.

MOVE calls the Windows MoveFileWithProgress API. If it succeeds and you have the notify shell option set, it then calls SHChangeNotify. (Do you have the notify option set?)

If the MoveFileWithProgress call fails, MOVE calls CopyFileEx and then deletes the source.

COPY just calls CopyFileEx.
 
I do have "Notify Windows Shell on File or Directory Change? checked.

I just tried again. If I MOVE the file, it's moved but its desktop icon remains (in a rather sorry state). OTOH, if I DEL the file, the desktop icon disapears.
 
I do have "Notify Windows Shell on File or Directory Change? checked.

I just tried again. If I MOVE the file, it's moved but its desktop icon remains (in a rather sorry state). OTOH, if I DEL the file, the desktop icon disapears.

Then it's probably the SHChangeNotify call(which passes the SHCNE_RENAMEITEM flag). Apparently Microsoft didn't want to support renaming to another drive / device in SHChangeNotify.
 
Odd! If an explorer window showing the source folder is open, then after a MOVE the source file disappears.
That's also true for the desktop ... if I have an Explorer window showing the desktop folder's contents, then after moving a file from the desktop, it disappears from the Explorer folder and also from the actual desktop.
 
Do you use MOVEFILE_COPY_ALLOWED (0x2) with MoveFileWithProgress().
 
The anomaly is the same when moving a file from another drive *TO* the desktop; an icon does not appear on the desktop (but does if there's also an Explorer window open showing the desktop's contents.
 
It soesn't seem too hard to get the desktop updated. This does it.
Code:
WCHAR szSource[MAX_PATH] = L"c:\\users\\vefatica\\desktop\\test.file";
WCHAR szDest[MAX_PATH] = L"k:\\test.file";
MoveFileWithProgress(szSource, szDest, NULL, NULL, MOVEFILE_COPY_ALLOWED);
 

Similar threads

Back
Top