To avoid this issue, you can use the following two APIs in an application, and then run the application alongside Windows Explorer to make sure Windows Shell receives the related message:
- RegNotifyChangeKeyValue. Use this API to monitor the following registry key:HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment
When the registry key is changed, use SendNotifyMessageto send a broadcast WM_SETTINGCHANGE message that has lparam set to the "Environment" string.
- CreateEnviornmentBlock. Use this API to start the new process by using this environment block. This prevents the application from inheriting the Explorer.exe environment block.
Article ID: 3166232 - Last Review: Nov 1, 2016 - Revision: 1