Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

User names in Clipper? 1

Status
Not open for further replies.

laado

Programmer
Oct 17, 2002
35
AU
Hi Guys
Can anybody put me in right direction, as to how can i
get a user name , i mean how can i get a Login Name used to
log on a computer where the Exe is Running?

Hope i have explained it well.

Thanks
 
On Windows 2000 it's stored as an environment variable, so:
cUserName := GETENV("USERNAME")
should do it.

I don't think this is the case in 95/98 though. Ian Boys
DTE Systems Ltd
 
try using NetName()

This will give you a workstation id followed by the
user id. I think the two fields are separated by a hash
'#' symbol.

HTH

Regards

Griff
Keep [Smile]ing
 
Griff,
All it returns is workstation name in W2K. Mind you, thats what the Norton Guides say it will do.

Regards
Ian Ian Boys
DTE Systems Ltd
 
Thanks a lot
I will try it out today, What about Windows 98?
Regards
 
In Windows 98 there is no 'automatic' USERNAME environemt variable, you have to create one. Create a small user logon script (batch file) which runs whenever the user logs on and sets an environment variable to the username, eg.

{EDWARD.BAT <-run when user Edward logs on.}
@WINSET LOGINNAME=&quot;EDWARD&quot;

winset.exe is a file on the Windows98 CD hidden somewhere in ADMIN or NETTOOLS. Do a search. It 'permanently' sets environment variables that are accessable from within DOS programs and must be copied to a PATH directory, eg C:\WINDOWS

Then in the program use:
cUserName := GETENV(&quot;LOGINNAME&quot;)

If you're not familiar with logon scripts have a look at the WindowsNT forum or Microsoft site. If the computer is only used by one person, it could be placed in AUTOEXEC.BAT file.

Regards.
 
Windows 2000, I am having problems with the computers running on windows 98

thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top