>the env var is changed
Changed by what? Another program?
Each process in Windows has its own environment block, the initial contents of which are (by default) inherited from the process' parent when the new process is being created; this is the only time that one process can directly affect the environment variables of another process. Changes to values in one process cannot and do not affect the values in the environment block of another process. And GetEnvironmentVariable will only retrieve values from the environment block of the process from which it is called. There are no API calls that will get or set* environment variables in the environment block of another process.
(*actually, this is not 100% true; there is a class of environment variables known as a system environment variables. To programmatically add or modify these, add them to the HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment registry key, then broadcast a WM_SETTINGCHANGE message)