>>>>>There is little I can find on this WIN32API function as it pertains to anything other than C++. Any thoughts as to its arguments or an alternative means to achieving the same result? The aim is to get the "windows" directory.Thank you in advance.
>>>>
>>>>There's an entry in the FAQ that I wrote, FAQ#7806, that gives an exact implementation of this in VFP. It's under
Win32 and Other APIs>>>
>>>And there's also GETENV('WINDIR'). However, I don't know if it's reliable under NT.
>>
>>GETENV() works, but IMO is not the preferred method to use, since the environment variable can be changed by batch files or scripts. It's particularly suspect when issued from a spawned process, where the parent process may have mucked with the environment inherited by the child.
>
>I agree (as you might expect). The only thing I'd say is that
any process (outside of Windows) that fools with this environment variable should be immediately relegated to the "bit-bucket". There are a lot of "ill-behaved" programs out there, but this would take that phrase to a different level of meaning< g >.
Agreed, but it's often accidental. For example, both CreateProcess() and ShellExecuteEx() have the ability to define a new environment name space to pass to a child process. Not everyone reads the docs, and they don't realize that you have to load the entire environment namespace; the new environment, if specified, is not passed with along with the new one...