O$: Studio 10, getting environment variables

Debra Peters dshaberlanda at yahoo.com
Mon Jun 17 20:56:32 EDT 2019


Bonus points, Kelly.
Thank you for the additional information.

Deb

On 6/17/2019 6:52 PM, Kelly Burgess wrote:
> Hi Deb,
>
>> We use something like the following:
>> Register DLL ('kernel32.dll','GetEnvironmentVariableW','JCC')
>> Call DLL ('kernel32.dll','GetEnvironmentVariableW','CLIENTNAME',varClientName)
>> Returns %%Error
>>
>> We retrieve CLIENTNAME, COMPUTERNAME, USERDOMAIN, and a few other environment
>> variables
> I'm glad you have a workaround using getenv(), but what bothered me is that there shouldn't be any difference in using Register/CallDLL from Studio 10.
>
> I tried your example and it failed for me, too, but then I looked up the function, and the docs say it has three parameters, not two.
>
>    https://docs.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbase-getenvironmentvariable
>
> So I tried adding the third parameter, and I also changed CLIENTNAME to USERNAME, and it's working for me like this:
>
>    Register DLL ('kernel32.dll','GetEnvironmentVariableW','JCCJ')
>    Call DLL ('kernel32.dll','GetEnvironmentVariableW','USERNAME',varClientName,255) Returns err
>
> FYI,
>
> Kelly
> _____________________________________________________________
> Manage your list subscriptions at http://lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com
>
-- 
KI5BES

???Live a good and honorable life, then when you get older and think back, you???ll enjoy it a second time.???




More information about the omnisdev-en mailing list