#GetEnvString() prob.
3 messages in this thread
I have a Win32 application that displays the current environment in a list box
using GetEnvironmentString() and then filling the list box. Under NT it works
fine, but under Win32s, all of the environment variables set in DOS are shown,
but only a few of the environment variables set by the program are shown.
Subsequent calls to getenv() show that the variables that are not shown are in
fact set.
Is there a problem with GetEnvironmentString() under Win32s 1.0?
TIA,
Arun.
There is 1 Reply.
>>>I have a Win32 application that displays the current environment in a
list box using GetEnvironmentString() and then filling the list box.
Under NT it works fine, but under Win32s, all of the environment
variables set in DOS are shown, but only a few of the environment
variables set by the program are shown. Subsequent calls to getenv()
show that the variables that are not shown are in fact set.
>>>Is there a problem with GetEnvironmentString() under Win32s 1.0?
No, I have not heard of such problems. However, the comments in the
GetEnvironmentStrings() API state that it should not be used to retrieve the
values of an environment variable, but that GetEnvironmentVariable() should
be used. Have you tried using GetEnvironmentVariable?
Lee
There is 1 Reply.
I use GetEnvironmentString() to be able to show the user what special options
for the program are set, since there are 50+ different variables that may or
may not be set. It would be nice to be able to display all currently set
variables without having to use brute force and test each one individually.
The values of the environment variables are not obtained from the
GetEnvironmentString() call; I use getenv() to do that.
Basically, I would like a way to display the table of all currently set
environment variables under Win32s and NT. GetEnvironmentString() seems to be
the only API call that fits the bill, but as I stated earlier, it does not seem
to be functioning correctly under Win32s. Variables that are supposedly not
present according to the table returned by GetEnvironmentString() are in fact
set by checking their values with getenv(). This leads me to believe there is
a problem with this API call. Would using SetEnvironmentVariable() possibly
help any, or does getenv() simply map to this?
TIA,
Arun.