David Smith wrote: > Now I'm confused too. In "My Computer", the Advanced page shows the > environmental variables. I presume that these are global and > inherited by any console session.
Any new program that Explorer starts will have that environment. If you change the values in that dialog, no already running process gets the new values, unless it's listening for and handling wm_SettingChange messages. Console programs are not special. (They can even listen for messages just like everyone else, if they want.) But like I said before, new processes inherit the environments of their parent processes unless the parents do something special; read about the lpEnvironment parameter of CreateProcess. I suspect that when Explorer starts a new process, it loads the system environment variables from the registry and constructs the environment itself instead of just using a null pointer for the lpEnvironment parameter. > These are not modified by SetEnvironmentVariable()? Correct. Try it and see. Also, when you wonder what an API function does, remember to check the documentation: "Sets the contents of the specified environment variable for the current process. ... This function has no effect on the system environment variables or the environment variables of other processes." -- Rob

