hello all,
in my MFC-application I change the value of an environment variable by using CRegKey. After changing the value I call
to inform other programs, that the environment has changed. But when I want to use the changed environment variable by using getenv(), it has still the old value. Even other programs I call from my application have still the old value of the variable. First if I restart my program, the new value is available.
Is it possible to refresh the environment setting of my program during runtime, or is a restart allways necessary?
Or do I just misuse SendMessageTimeout()?
thank you!
in my MFC-application I change the value of an environment variable by using CRegKey. After changing the value I call
Code:
SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0,(LPARAM)"Environment", SMTO_ABORTIFHUNG,5000,&returnValue);
to inform other programs, that the environment has changed. But when I want to use the changed environment variable by using getenv(), it has still the old value. Even other programs I call from my application have still the old value of the variable. First if I restart my program, the new value is available.
Is it possible to refresh the environment setting of my program during runtime, or is a restart allways necessary?
Or do I just misuse SendMessageTimeout()?
thank you!