forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Need XP Registry Key
Goto page 1, 2  Next
 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
Serge
Professional Member
Professional Member


Joined: 04 Mar 2002
Posts: 1480
Location: Australia

PostPosted: Sun May 23, 2004 1:36 am    Post subject: Need XP Registry Key Reply with quote

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
View user's profile Send private message Visit poster's website MSN Messenger
Vic D'Elfant
Past Contributor
Past Contributor


Joined: 26 Jun 2002
Posts: 673
Location: The Netherlands

PostPosted: Sun May 23, 2004 8:53 am    Post subject: Reply with quote

You could use the VDS @env() function... @env(username) Wink

Regards,
Vic

_________________
phpBB Development Team
Back to top
View user's profile Send private message Visit poster's website
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Sun May 23, 2004 5:20 pm    Post subject: Reply with quote

There is also API code to do this in VDS 5 Smile I will post a link to that when I find it.
_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
Serge
Professional Member
Professional Member


Joined: 04 Mar 2002
Posts: 1480
Location: Australia

PostPosted: Mon May 24, 2004 8:39 am    Post subject: Reply with quote

thanks vic...your tip is perfect Smile

ff...thanks for the alternative method...someone may find the api call useful when you get around to it Smile

serge

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
DavidR
Contributor
Contributor


Joined: 05 Aug 2003
Posts: 83
Location: Bethel Pennsylvania U.S.A.

PostPosted: Mon May 24, 2004 9:46 am    Post subject: Reply with quote

Vic wrote:
You could use the VDS @env() function... @env(username) Wink

Regards,
Vic

Incredible! And I was doing this the "Hard" way (registry entries) Embarassed

Is there an easy way to get a list of ALL environment variables ??
Thanks
.........David
Back to top
View user's profile Send private message
Serge
Professional Member
Professional Member


Joined: 04 Mar 2002
Posts: 1480
Location: Australia

PostPosted: Mon May 24, 2004 10:09 am    Post subject: Reply with quote

hi david,

i had the same thought and after doing a google search i came up with http://kennethhunt.com/archives/000933.html

serge

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
DavidR
Contributor
Contributor


Joined: 05 Aug 2003
Posts: 83
Location: Bethel Pennsylvania U.S.A.

PostPosted: Mon May 24, 2004 10:13 am    Post subject: Reply with quote

Serge wrote:
hi david,

i had the same thought and after doing a google search i came up with http://kennethhunt.com/archives/000933.html

serge

Razz Hey Thanks, That will get added to my stack of reference materials!
I love this forum... Very Happy
Back to top
View user's profile Send private message
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Mon May 24, 2004 11:08 am    Post subject: Reply with quote

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
View user's profile Send private message
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Mon May 24, 2004 12:01 pm    Post subject: Reply with quote

Yes - @env(username) does not work with Windows 95, not sure if it even works with Win 98... Smile
_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Mon May 24, 2004 12:33 pm    Post subject: Reply with quote

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! Mad

_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
Serge
Professional Member
Professional Member


Joined: 04 Mar 2002
Posts: 1480
Location: Australia

PostPosted: Mon May 24, 2004 2:10 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website MSN Messenger
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Sat Jun 05, 2004 12:00 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Vic D'Elfant
Past Contributor
Past Contributor


Joined: 26 Jun 2002
Posts: 673
Location: The Netherlands

PostPosted: Sat Jun 05, 2004 8:51 am    Post subject: Reply with quote

FreezingFire wrote:
Yes - @env(username) does not work with Windows 95, not sure if it even works with Win 98... Smile


It works with Win98 Smile

Vic

_________________
phpBB Development Team
Back to top
View user's profile Send private message Visit poster's website
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Sat Jun 05, 2004 1:04 pm    Post subject: Reply with quote

ok then it's just 95 then Smile It may vary system to system, as I tried this
on my Windows 98 computer a long while back and it did not work. Confused

_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
Vic D'Elfant
Past Contributor
Past Contributor


Joined: 26 Jun 2002
Posts: 673
Location: The Netherlands

PostPosted: Sat Jun 05, 2004 1:09 pm    Post subject: Reply with quote

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 Confused

Vic

_________________
phpBB Development Team
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group