Hi ...

I have read many articles that describe the process to update environment variables in another process. As I understand I should be able to change the either of the regsitry values below ...

HKEY_CURRENT_USER\Environment
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment";

and then call SendMessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0, 0) tp propagate these setting to other applications.

When I do this I do not see the environment variables in my current console process change when I use SET to display the environment variables in the console.

?? Why don't I see the change in the console ??

Below is some code / Details:

- I open a command prompt using Windows XP.

- Use SET to view environment variables (MXBUILD_VERSION) is not present.

- Start a command file that gets files from SourceSafe and then calls a program called ManageVersion.

- ManageVersion will update the version info in the version.h file and then save the version info to an enviroment variable called MXBUILD_VERSION. I have sent this in both the User and System Regsitry in an attempt to propogate the value to the console enviroment. After the registry is update dhten I call the SendMessage() method.


Code:
    // We tryed both methods
    nReturn = SendMessageTimeout(HWND_BROADCAST, 
                                 WM_SETTINGCHANGE, 
                                 0,
                                 (LPARAM) "Environment", 
                                 SMTO_ABORTIFHUNG,
                                 5000, 
                                 &dwReturnValue);

    nReturn = SendMessage(HWND_BROADCAST, 
                          WM_SETTINGCHANGE, 
                          0, 
                          0);
Thanks,
Chris
[email protected]
www.macgowan.com









nReturn = SendMessage(HWND_BROADCAST,
WM_SETTINGCHANGE,
0,
0);