Re: Force System Variable Reload w/o reboot

From: alpine (alpine_don'tsendspam_at_mvps.org)
Date: 09/10/04


Date: Fri, 10 Sep 2004 12:17:34 -0600

If you are launching the VB3 app after setting the new value, you may
want to have a look at the Set Environment example at
http://www.mvps.org/vbvision/

HTH,
Bryan
____________________________________________________________
New Vision Software "When the going gets weird,"
Bryan Stafford "the weird turn pro."
alpine_don'tsendspam@mvps.org Hunter S. Thompson -
Microsoft MVP-Visual Basic Fear and Loathing in LasVegas

On Fri, 10 Sep 2004 11:23:14 -0600, "Andrew M"
<andrewmaxin@hotmail.com> wrote:

>Bob
>
> Thank you for your reply. I tried you code but regretably, it did not
>work. I am trying to set an environment variable that is read by a legacy
>VB3 application that uses the VB "Environ$" method. Although the Windows
>Environment Variables Dialog respects the change, this variable does not.
>what I need is an API that mimics loading the environment variables from the
>registry as it does on startup. If there is another place (in memory or on
>disk) that this value is being stored, that would work too.
>
>Andrew
>
>
>"Bob Butler" <tiredofit@nospam.com> wrote in message
>news:O9d4wN1lEHA.644@tk2msftngp13.phx.gbl...
>> "Andrew M" <andrewmaxin@hotmail.com> wrote in message
>> news:10k3kqnetq75la2@corp.supernews.com
>>> Hello
>>>
>>> I am trying to reset a custom system-level environment variable
>>> for an application. I am having an issue with syncronization of the
>>> changes. Is there a way to force windows (Win98 and up) to reload
>>> that variable from the registry w/o having to reboot?
>>
>> try this
>>
>> Private Const HWND_BROADCAST = -1
>> Private Const WM_WININICHANGE = &H1A
>> Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
>> (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, _
>> ByRef lParam As Any) As Long
>>
>> Dim x As Long
>> x = SendMessage(HWND_BROADCAST, WM_WININICHANGE, 1, ByVal 0&)
>>
>> not all apps recognize this so some things will not pick up the new
>> environment variable setting but the explorer shell should
>>
>



Relevant Pages

  • Re: ENV variable NOT recognized ! Reboot really necessary ????
    ... this will only change the environment block for new processes created *after* the change. ... Existing processes will keep on using their current environment block, which is the same as it was before you made the change. ... But an application needs to be written to explicitly do this; there's no mechanism in the operating system to universally update environment variables on the fly for running processes. ... For example, say you had a command prompt open, and you run a SET command to display the current variables. ...
    (microsoft.public.windowsxp.help_and_support)
  • [REVS] Using Environment for Returning Into Lib C
    ... This article explains how to use the environment variables to successfully ... The environment will consequently be used to store it. ... It is easy to write a simple program to put the command directly into the ... declare -x COLORTERM="" ...
    (Securiteam)
  • Re: Force System Variable Reload w/o reboot
    ... > If you are launching the VB3 app after setting the new value, ... > want to have a look at the Set Environment example at ... I am trying to set an environment variable that is read by a legacy ... >>Environment Variables Dialog respects the change, ...
    (microsoft.public.vb.winapi)
  • Re: SSH environment variable passing
    ... has to be a capability of both the client and the server. ... to support only a couple of specific environment variables. ... I have been told that allowing unlimited environment variables to be set ... A parallel situation exists in telnet. ...
    (SSH)
  • Re: Multiple interpreters retaining huge amounts of memory
    ... environment variable separation for changes made unique to a sub ... you can make changes to environment variables ... extension module in different sub interpreters, ...
    (comp.lang.python)