Subject: | 5.12.1.0.beta_1 - update_env.pl (no re-login) |
Cusrtis,
Just to keep a record of our e-mail communication:
The problem with relogin-neede after setting ENV variables via registry is in fact a feature, see http://msdn.microsoft.com/en-us/library/ms682653%28VS.85%29.aspx - quote:
To programmatically add or modify system environment variables, add them to the HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment registry key, then broadcast a WM_SETTINGCHANGE message with lParam set to the string "Environment".
and solution here: http://www.perlmonks.org/?node=171505
it works like this:
Show quoted text
use constant HWND_BROADCAST => -1;
use constant WM_SETTINGCHANGE => 0x1a;
... here set proper registry values ...
my $SendMessage = new Win32::API("user32", "SendMessage", 'NNNP', 'N') or die "Couldn't create SendMessage: $!\n";
my $RetVal = $SendMessage->Call(HWND_BROADCAST,WM_SETTINGCHANGE,0,'Environment');
Show quoted text
You have to open a new command prompt but no need to re-login
The side effect is that we need to include Win32::API module into strawberry release.
--
kmx
Just to keep a record of our e-mail communication:
The problem with relogin-neede after setting ENV variables via registry is in fact a feature, see http://msdn.microsoft.com/en-us/library/ms682653%28VS.85%29.aspx - quote:
To programmatically add or modify system environment variables, add them to the HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment registry key, then broadcast a WM_SETTINGCHANGE message with lParam set to the string "Environment".
and solution here: http://www.perlmonks.org/?node=171505
it works like this:
Show quoted text
#####################
use Win32::API;use constant HWND_BROADCAST => -1;
use constant WM_SETTINGCHANGE => 0x1a;
... here set proper registry values ...
my $SendMessage = new Win32::API("user32", "SendMessage", 'NNNP', 'N') or die "Couldn't create SendMessage: $!\n";
my $RetVal = $SendMessage->Call(HWND_BROADCAST,WM_SETTINGCHANGE,0,'Environment');
Show quoted text
#####################
You have to open a new command prompt but no need to re-login
The side effect is that we need to include Win32::API module into strawberry release.
--
kmx