I am currently writing an unmanaged C ++ program that works with a system environment variable. I get the value using GetEnvironmentVariable (...). Now I have a C # program that can change this variable at any time, for example. eg:
Environment.SetEnvironmentVariable("CalledPath", System.Windows.Forms.Application.ExecutablePath, EnvironmentVariableTarget.Machine);
The problem is that the C ++ program does not update this variable (or its environment block as a whole) automatically, so I still work with the old value unless I restart the program, which is not very good. Is there a way to update the environment block or, preferably, another way to read system environment variables?
Thanks in advance, Russo
Russo source
share