[TC9.51] incomplete WM_SETTINGCHANGE handle: TC ignores an environment variable remove
Posted: 2021-01-21, 22:12 UTC
* Windows x64 Pro SP1
If try to directly remove an environment variable from the registry: `HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment`
and then send globally `WM_SETTINGCHANGE` window message, then the TC ignores removed variable.
I use this vbs script to trigger `WM_SETTINGCHANGE`:
For example, the Windows Explorer correctly handles that case.
If try to directly remove an environment variable from the registry: `HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment`
and then send globally `WM_SETTINGCHANGE` window message, then the TC ignores removed variable.
I use this vbs script to trigger `WM_SETTINGCHANGE`:
The script must be called under the Administrator privileges.Set objShell = WScript.CreateObject("WScript.Shell")
Set objSystemEnv = objShell.Environment("System")
' triggers WM_SETTINGCHANGE
objSystemEnv("Path") = objSystemEnv("Path")
For example, the Windows Explorer correctly handles that case.