View previous topic :: View next topic |
Author |
Message |
Serge Professional Member
Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Sun May 23, 2004 1:36 am Post subject: Need XP Registry Key |
|
|
Hi all,
does someone know what the registry key is for obtaining the username of the person logged in at the time a program is run?
i found a registry entry but got confused with "default user", "user id", and such like...
thanks in advance
serge _________________
|
|
Back to top |
|
|
Vic D'Elfant Past Contributor
Joined: 26 Jun 2002 Posts: 673 Location: The Netherlands
|
Posted: Sun May 23, 2004 8:53 am Post subject: |
|
|
You could use the VDS @env() function... @env(username)
Regards,
Vic _________________ phpBB Development Team |
|
Back to top |
|
|
FreezingFire Admin Team
Joined: 23 Jun 2002 Posts: 3508
|
Posted: Sun May 23, 2004 5:20 pm Post subject: |
|
|
There is also API code to do this in VDS 5 I will post a link to that when I find it. _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
Back to top |
|
|
Serge Professional Member
Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Mon May 24, 2004 8:39 am Post subject: |
|
|
thanks vic...your tip is perfect
ff...thanks for the alternative method...someone may find the api call useful when you get around to it
serge _________________
|
|
Back to top |
|
|
DavidR Contributor
Joined: 05 Aug 2003 Posts: 83 Location: Bethel Pennsylvania U.S.A.
|
Posted: Mon May 24, 2004 9:46 am Post subject: |
|
|
Vic wrote: | You could use the VDS @env() function... @env(username)
Regards,
Vic |
Incredible! And I was doing this the "Hard" way (registry entries)
Is there an easy way to get a list of ALL environment variables ??
Thanks
.........David |
|
Back to top |
|
|
Serge Professional Member
Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
|
Back to top |
|
|
DavidR Contributor
Joined: 05 Aug 2003 Posts: 83 Location: Bethel Pennsylvania U.S.A.
|
Posted: Mon May 24, 2004 10:13 am Post subject: |
|
|
Hey Thanks, That will get added to my stack of reference materials!
I love this forum... |
|
Back to top |
|
|
Dr. Dread Professional Member
Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Mon May 24, 2004 11:08 am Post subject: |
|
|
Be aware that the environment variables available may vary from system to system. Try the command SET in a
command prompt - that should bring up the current list and the corresponding values.
Greetz
Dread _________________ ~~ Alcohol and calculus don't mix... Don't drink and derive! ~~
String.DLL * advanced string processing |
|
Back to top |
|
|
FreezingFire Admin Team
Joined: 23 Jun 2002 Posts: 3508
|
Posted: Mon May 24, 2004 12:01 pm Post subject: |
|
|
Yes - @env(username) does not work with Windows 95, not sure if it even works with Win 98... _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
Back to top |
|
|
FreezingFire Admin Team
Joined: 23 Jun 2002 Posts: 3508
|
Posted: Mon May 24, 2004 12:33 pm Post subject: |
|
|
I have been looking for quite a while for the API code that returns the
current username. I know it was somewhere on this forum - but I can't
find it! _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
Back to top |
|
|
Serge Professional Member
Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Mon May 24, 2004 2:10 pm Post subject: |
|
|
just to clarify...the environment variables mentioned in the link i gave are for windows xp and 2000 only...some of these variables are not supported by 95, 98 or me
serge _________________
|
|
Back to top |
|
|
vdsalchemist Admin Team
Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Sat Jun 05, 2004 12:00 am Post subject: |
|
|
Hi All,
The code below should work on just about any version of Windows.
Code: | LoadLib advapi32.dll
%A = @fill(256,Z)
%B = @Binary(DWORD,256)
%%Ret = @lib(advapi32,GetUserNameA,BOOL:,@Addr("%A"),@Addr("%B"))
Info The Current User is %A
FreeLib advapi32
exit
|
_________________ Home of
Give VDS a new purpose!
|
|
Back to top |
|
|
Vic D'Elfant Past Contributor
Joined: 26 Jun 2002 Posts: 673 Location: The Netherlands
|
Posted: Sat Jun 05, 2004 8:51 am Post subject: |
|
|
FreezingFire wrote: | Yes - @env(username) does not work with Windows 95, not sure if it even works with Win 98... |
It works with Win98
Vic _________________ phpBB Development Team |
|
Back to top |
|
|
FreezingFire Admin Team
Joined: 23 Jun 2002 Posts: 3508
|
Posted: Sat Jun 05, 2004 1:04 pm Post subject: |
|
|
ok then it's just 95 then It may vary system to system, as I tried this
on my Windows 98 computer a long while back and it did not work. _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
Back to top |
|
|
Vic D'Elfant Past Contributor
Joined: 26 Jun 2002 Posts: 673 Location: The Netherlands
|
Posted: Sat Jun 05, 2004 1:09 pm Post subject: |
|
|
Hm.. that's weird. I'll double-check it, because I'm using it in a huge project that's only running at windows 98
Vic _________________ phpBB Development Team |
|
Back to top |
|
|
|