O$10.22: GetEnvironmentVariableW

kim at martel.com.au kim at martel.com.au
Sat Aug 27 07:55:16 UTC 2022


Hi Wayne

I use this frequently in my programs to display or confirm which user is
using the program.  

Do listenv() Returns List
Do getenv("username") Returns iUserName

Can remember which version of studio I started using it.  I think it may
have been when went 64 bit.
Works well with OS20.22

Kim Martel
kim at martel.com.au 


-----Original Message-----
From: omnisdev-en <omnisdev-en-bounces at lists.omnis-dev.com> On Behalf Of
Wayne Germann
Sent: Saturday, 27 August 2022 8:11 AM
To: OmnisDev List - English <omnisdev-en at lists.omnis-dev.com>
Subject: RE: O$10.22: GetEnvironmentVariableW

Does anyone know how to get the logged on users name?

-----Original Message-----
From: omnisdev-en <omnisdev-en-bounces at lists.omnis-dev.com> On Behalf Of
Phil (OmnisList)
Sent: Friday, August 26, 2022 2:17 PM
To: omnisdev-en at lists.omnis-dev.com
Subject: Re: O$10.22: GetEnvironmentVariableW

CAUTION: This email originated from outside of Pacific. Do not click any
links or open attachments if this is unsolicited email.

Hi Greg,

I have different call for the computer name:

Register DLL('kernel32','GetComputerNameW','ICM')

Call DLL('kernel32','GetComputerNameW',lcComputername,255)


But for your call, I think you are missing a parameter:

Register DLL('kernel32.dll','GetEnvironmentVariableW','ICCM')

Call
DLL('kernel32.dll','GetEnvironmentVariableW','COMPUTERNAME',lcComputername,2
55)

Register DLL('kernel32.dll','GetEnvironmentVariableW','ICCM',kTrue)


regards
Phil Potter
Based in Chester in the UK.

On 26/08/2022 20:38, Grzegorz (Greg) Pasternak wrote:
>
> The following code works on Windows 10 64bit in Omnis Studio 5.1 
> Register DLL ('kernel32.dll','GetEnvironmentVariableW','JCC')
> Call DLL
> ('kernel32.dll','GetEnvironmentVariableW','COMPUTERNAME',vComputerName
> ) Returns vError
>
> but it does not work on Windows 10 64bit in Omnis Studio 10.22
>
> Any suggestions why?
>
> Grzegorz (Greg) Pasternak
>
>
>
>
>
> _____________________________________________________________
> Manage your list subscriptions athttps://lists.omnis-dev.com Start a 
> new message ->mailto:omnisdev-en at lists.omnis-dev.com
_____________________________________________________________
Manage your list subscriptions at https://lists.omnis-dev.com Start a new
message -> mailto:omnisdev-en at lists.omnis-dev.com
_____________________________________________________________
Manage your list subscriptions at https://lists.omnis-dev.com Start a new
message -> mailto:omnisdev-en at lists.omnis-dev.com 


-- 
This email has been checked for viruses by AVG antivirus software.
www.avg.com


More information about the omnisdev-en mailing list