Bug in retrieving environment variables via Getenvironmentvariable 
Author Message
 Bug in retrieving environment variables via Getenvironmentvariable

Help! I'm using VB5 under NT4 and have an app which needs to obtain DOS
environment variables set using a DOS batch file. The DLL
Getenvironmentvariable should be able to obtain them for me, however for
some reason i can only retrieve the 'Path' environment variable not any of
my own i have set in my batch file. Any ideas?



Sat, 29 Apr 2000 03:00:00 GMT  
 Bug in retrieving environment variables via Getenvironmentvariable

First, make sure you have allocated enough space in your return string for
the entire set of environment strings (you probably have, 'cause you'd GPF
otherwise...).

The different environment strings are separated by ascii zeroes (with a
double-zero at the end of the whole mess).  Many functions (such as
Debug.Print) will stop operating on a string when they encounter a zero
("C" strings are always terminated this way).

Use Instr(nStart, sMyEnviro, Chr$(0)) iteratively to find all the zeroes
and parse out the substrings.

Jim Deutch
MS Dev MVP



Quote:
> Help! I'm using VB5 under NT4 and have an app which needs to obtain DOS
> environment variables set using a DOS batch file. The DLL
> Getenvironmentvariable should be able to obtain them for me, however for
> some reason i can only retrieve the 'Path' environment variable not any
of
> my own i have set in my batch file. Any ideas?



Sat, 29 Apr 2000 03:00:00 GMT  
 Bug in retrieving environment variables via Getenvironmentvariable

->Help! I'm using VB5 under NT4 and have an app which needs to obtain
DOS
->environment variables set using a DOS batch file. The DLL
->Getenvironmentvariable should be able to obtain them for me, however
for
->some reason i can only retrieve the 'Path' environment variable not
any of
->my own i have set in my batch file. Any ideas?

Did your DOS batch file load prior to NT loading? If not, this will
definitely not be possible since the environment variables would be
local to the process/task from which they were loaded.

Paul
~~~~



Sun, 30 Apr 2000 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. retrieving environment variables in VBscript : how ???

2. Using API to retrieve environment variables?

3. Help Retrieving Environment Variable on Server

4. Setting environment Variables via VB Script

5. Error 3343 with MDB via DAO 3.51 in multi-user environment

6. How to deletea record via data environment

7. Bug in VB4/16 development environment ?!?

8. Environment Vars not passed to new process via IWshShell_Class::Run command

9. VB6 ADO Data Environment Bug or not

10. Modifying records via a Data Environment

11. Error connecting Report to database via Data Environment

12. Data Environment and setting the connection string via code

 

 
Powered by phpBB® Forum Software