microsoft / winfile

Original Windows File Manager (winfile) with enhancements
MIT License
6.75k stars 698 forks source link

Make the refresh menu item refresh the left pane #413

Closed malxau-msft closed 6 months ago

malxau-msft commented 6 months ago

TC_SETDRIVE currently takes three boolean values encoded into wParam and an optional path in lParam. If lParam is NULL, it looks up the directory from FS_GETDIRECTORY.

Between original_plus and the first 10.0 release, a change was made in TC_SETDRIVE that will update the selection without a refresh if the value supplied in lParam can be found in the existing tree. In some cases, such as the View File Types dialog, TC_SETDRIVE is invoked with a NULL lParam, which causes a full refresh to occur. In others, including RefreshWindow, lParam is supplied as a directory, which has the effect of suppressing any refresh.

This change modifies RefreshWindow to not supply lParam as a way to cause the refresh to happen. The previous code was calling FS_GETDIRECTORY from RefreshWindow, then calling FS_CHANGEDRIVES, then calling TC_SETDRIVE. The code reads as though it expects FS_CHANGEDRIVES to invalidate the directory, so it must be saved first. However, I do not see FS_CHANGEDRIVES doing this, and have looked back to the oldest source I can find in Windows 3.1 (where FS_CHANGEDRIVES is very different) but still don't see it doing this. The "worst" case I can find or think of is if FS_CHANGEDRIVES decides that the drive owned by a window no longer exists, but in this case, the code was already setting lParam to NULL. I've tested this case and even with this change the program seems to behave correctly (it displays an error to the user about the drive being invalid before and after this change.)

That said, there are other options for a fix: