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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get System Variables ? 1

Status
Not open for further replies.

lstephane

Programmer
Nov 19, 2002
35
0
0
CA
Hi,

I need to trap Windows Username and Machine Name (as set into Windows) to build a log file.

How do I get theses informations into VB6 ?

Thanks !

Stéphane Lambert, Analyst/Programmer - BI Specialist
Info Quest (IQ), Data Warehouse System
McKesson Canada Corporation

EMail: stephane.lambert@mckesson.ca
 
If they are environment variables you can get them like so:

strUserName = Environ("UserName")

To get all of them, do this:

lngX = 1
Do While Len(Environ(lngX)) > 0
MsgBox (Environ(lngX))
lngX = lngX + 1
Loop

Good Luck!

Have a great day!

j2consulting@yahoo.com
 
strongm or hypetia should be along quickly to explain why environment variables are unreliable.
 
I'll just let Keyword search do the talking... ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top