in reply to Win32 GetEnvironmentVariables?

Look for %ENV in perlvar.

Replies are listed 'Best First'.
Re^2: Win32 GetEnvironmentVariables?
by Anonymous Monk on Nov 10, 2006 at 21:51 UTC
    Sorry I should have been more specific. I actually need to access a dll on windows and retrieve specific environment variables it sets.

      Unless the dll was bound to perl, the changes won't be made until you load the dll. It then depends when the dll sets/changes the environment variables.

      If they are set/changed by the dlls initialisation, then you can

      use Win32; my $hModule = Win32::Loadibrary( 'thedll' );

      to load the library and then use GetEnvironmentStrings or GetEnvironmentVariable (via Win32::API) to get the modified environment for the perl process.

      If they don't get set until a particular api within the dll is called, then use Win32::API to load the dll and call the api before retrieving the new/modified values.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
        BrowserUK...That's exactley what I was looking for. I'm assuming the Syntax for GetEnvironmentVariable is the same via the Win32 API correct?
        Thanks
      There's no way of knowing which env vars a DLL sets unless you are the child process for which it has set them. That child process can access them via %ENV.
      If they are environment variables, why can't you access them through %ENV?