I found a branch in the registry called "Session Manager" that contains all the variables listed on the Advanced page of My Computer, editing the value there confirmed your theory since it was then modified in the Advanced page of My Computer. Thanks. Dave
--- On Sun, 8/17/08, Rob Kennedy <[EMAIL PROTECTED]> wrote: From: Rob Kennedy <[EMAIL PROTECTED]> Subject: Re: [delphi-en] Re: Set Environment Variable from Delphi Console App To: [email protected] Date: Sunday, August 17, 2008, 2:52 AM 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 SetEnvironmentVaria ble()? 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 [Non-text portions of this message have been removed]

