- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In a VB application (NT4 SP6) I'm using a fortran dll.
In the fortran routines use is made of the value of an environment variable (by calling GETENVQQ). To make sure the right value is used the VB part sets this value (using the function SetEnvironmentVariable from kernel32.dll). The value retrieved in the fortran routine is not the value set before from VB. The value from GetEnvironmentVariable looks correct however. What am I messing up?
In the fortran routines use is made of the value of an environment variable (by calling GETENVQQ). To make sure the right value is used the VB part sets this value (using the function SetEnvironmentVariable from kernel32.dll). The value retrieved in the fortran routine is not the value set before from VB. The value from GetEnvironmentVariable looks correct however. What am I messing up?
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm currently running Windows 2000, but I believe that NT is similar in the following respect. The environment variables are divided into User and System groups. The System group is the same for all users, but the User group is specific to a particular user.
Sometimes the variable names from the two groups are the same. In that case, I believe that the User group variable overrides the System group variable. Issuing the SET command at a DOS prompt will show you the values that are currently in force.
I don't know if the calls you are using have options to specify which group of variables you are accessing, but perhaps this has a bearing on your problem.
Mike Durisin
Sometimes the variable names from the two groups are the same. In that case, I believe that the User group variable overrides the System group variable. Issuing the SET command at a DOS prompt will show you the values that are currently in force.
I don't know if the calls you are using have options to specify which group of variables you are accessing, but perhaps this has a bearing on your problem.
Mike Durisin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It is not the system or user group that's causing this problem. The function SetEnvironmentVariable works. But it is changing/setting the value of an environment variable that is part of the set for a newly created process. And the call of GETENVQQ retrieves the value of that variable as is was at the creation of this process. So, as the documentation states: "The SetEnvironmentVariable function sets the value of an environment variable for the current process.", I seem to miss the basic ideas regarding the handling of process creation and environment tables.
As the function GetEnvironmentVariable gives the new value, is it correct that GETENVQQ retieves the old one?
As the function GetEnvironmentVariable gives the new value, is it correct that GETENVQQ retieves the old one?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Would you please submit a short example that demonstrates this problem to us at vf-support@compaq.com so that we may investigate?
Steve
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have just had to try to set-up and use environment variables within CVF and have encountered something similar.
Some limited experiments have suggested that, on Windows NT:
GETENVQQ "sees" enviroment varaiables set prior to execution and changes made via SETENVQQ, but not changes made via SetEnvironmentVariable.
GETENV does not "see" enviroment varaiables set prior to execution or changes made via SETENVQQ, but does see changes made via SetEnvironmentVariable.
I will send in an example to vf-support.
David Jones
Some limited experiments have suggested that, on Windows NT:
GETENVQQ "sees" enviroment varaiables set prior to execution and changes made via SETENVQQ, but not changes made via SetEnvironmentVariable.
GETENV does not "see" enviroment varaiables set prior to execution or changes made via SETENVQQ, but does see changes made via SetEnvironmentVariable.
I will send in an example to vf-support.
David Jones

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page