Refresh Explorer folder windows on shell change notifications - #168
Open
josuave wants to merge 3 commits into
Open
Refresh Explorer folder windows on shell change notifications#168josuave wants to merge 3 commits into
josuave wants to merge 3 commits into
Conversation
Becoming the OS shell window (SetShellWindow, required for shell-mode operation) stops Explorer's own folder view windows from receiving shell-level change notifications, since that delivery path is restricted to whichever process the OS currently trusts as "the shell". Work around this by registering for the same notifications at interrupt level (not subject to that restriction) and manually refreshing any open Explorer window browsing an affected folder via the Shell.Application COM automation object. Fixes cairoshell/cairoshell#434
added 2 commits
August 19, 2026 20:16
These are documented in shlobj_core.h (Shell32.lib) and exported by name from Shell32.dll since Windows 10, contrary to the prior comment — no need for the ordinal EntryPoint workaround from pre-documentation era shell programming.
- SHChangeNotifyRegister returns a ULONG registration ID (not a handle); SHChangeNotifyDeregister takes a ULONG. Both were declared as IntPtr, which happened to work on x64 by register- passing coincidence but didn't match the documented contract. - SHCNE's underlying type was C# long (64-bit); the native fEvents parameter is LONG (32-bit). - SHChangeNotification_Lock's dwProcId parameter must be the notification message's lParam when registered with SHCNRF_NewDelivery (as this code does), not a hardcoded 0 — per the function's documented remarks. Also corrects a comment that called SHChangeNotification_Lock/Unlock "undocumented, ordinal-exported" — they're documented in shlobj_core.h and exported by name from Shell32.dll.
josuave
marked this pull request as draft
August 20, 2026 00:30
josuave
marked this pull request as ready for review
August 20, 2026 01:27
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #434 — Explorer folder windows stop auto-refreshing (create/rename/copy/delete require a manual F5) whenever Cairo is running as the shell.
Testing