[fpc-pascal] SysUtils.GetEnvironmentVariable

Marcos Douglas md at delfire.net
Thu Mar 29 13:50:28 CEST 2012


On Thu, Mar 29, 2012 at 8:32 AM, Sven Barth <pascaldragon at googlemail.com> wrote:
> Am 29.03.2012 13:29, schrieb Marcos Douglas:
>
>> On Thu, Mar 29, 2012 at 8:13 AM, Sven Barth<pascaldragon at googlemail.com>
>>  wrote:
>>>
>>> Am 29.03.2012 13:06, schrieb Marcos Douglas:
>>>
>>>> The application is installed and the system variable is created. The
>>>> application and others process should be use this variable just
>>>> calling SysUtils.GetEnvironmentVariable.
>>>
>>>
>>>
>>> Then let a FPC program print all passed environment variables as a test:
>>>
>>>
>>> === source begin ===
>>>
>>> program envtest;
>>>
>>> var
>>>  i: LongInt;
>>> begin
>>>  for i := 0 to GetEnvironmentVariableCount do
>>>    Writeln(GetEnvironmentString(i)); // Note: this will include
>>> "name=value"
>>> unlike GetEnvironmentVariable
>>>
>>> end.
>>>
>>> === source end ===
>>
>>
>> I know it works on WinXP but my client uses Win7 and I don't have Win7
>> at this moment so, somebody can test this, please?
>
>
> The point is that for me it works.

Have you test on Win7 and worked using FPC 2.6.1? Strange... but thanks.

>>> Also - as I already wrote - you can use the Process Explorer (
>>> http://technet.microsoft.com/de-de/sysinternals/bb896653 ) to check
>>> whether
>>> the application does indeed contain the environment variable.
>>
>>
>> If the app do not found the environment variable, what I can tell to
>> the user? He do not know this things... the variable was set by
>> installer and the application should be able to use.
>
>
> Ok, that might be a problem then...

Well, I changed the application to search the correct path when
starts, instead of use the System Variable. Works fine but I wanted
comment this here because I thought there is something wrong with the
GetEnvironmentVariable function.

Marcos Douglas



More information about the fpc-pascal mailing list