> Does anyone know what system call is used when 2!:5 reads an > environment variable on WIndows?
i expect getenv(), a call to MSVCRT.dll. on most systems, the environment is an array of characters like "X=y" delmited by NULL '\0' chars. > According to Microsoft (http://support.microsoft.com/kb/q104011/) > changes to environment variables made by RegSetValue can be propogated > to other running processes > by using the SendMessageTimeout with HWND_BROADCAST as one of its > parameter values. yes, but the application (J) must handle this message > I have the following three experiences: > > (1) I can use RegSetValueExA to change a value and verify its new > value using RegQueryValueExA. > However 2!:5 does not return the new value in this session whether or > not I run SendMessageTimeout. maybe J doesn't handle this message > (2) SendMessageTimeout does, however, have an effect. If I change a > variable using RegSetValue, call SendMessageTimeout and then start a > second J session, 2!:5 sees the changed value. explorer.exe will respond to the message, and when J is launched, it inherits it's environment from explorer.exe (which has just been updated by handling the message) > (3) When I change a variable and then start a second J session without > calling SendMessageTimeout then this new session does not see the > changed value. i'd expect that. > I create the environment registry key required by RegSetValueExA using > h =. 1 {:: regcreatekey HKEY_CURRENT_USER;'Environment';3 > > Any suggestions how I can get a change propogated to an environment > variable so that 2!:5 will see it. handle the WM_SETTINGCHANGE message in you J code and call putenv() from MSVCRT.dll. i have no experience writing event loops for windows in J otherwise i'd give you an example. hope that helps, ta, jack. ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
