
ARCHIVE: TIPS & TRICKS
Quick system info retrieval
Kris McCann 02.13.2001
Rating: -4.67- (out of 5)




Quick system info retrieval
Kris McCann
Quite often it is necessary to retrieve certain information about the
system. I have seen all sorts of API calls to get snippets of
information such as the Windows directory, but a lot of people seem to
have missed the "environ" function. With this function you can return a
wealth of information from a single line of code - and it's fast.
Code: Environ("")
Returns a string, where can be any of the following:
ALLUSERSPROFILE
APPDATA
CommonProgramFiles
COMPUTERNAME
ComSpec
HOMEDRIVE
HOMEPATH
LOGONSERVER
NUMBER_OF_PROCESSORS
OS
Os2LibPath
Path
PATHEXT
PROCESSOR_ARCHITECTURE
PROCESSOR_IDENTIFIER
PROCESSOR_LEVEL
PROCESSOR_REVISION
ProgramFiles
SystemDrive
SystemRoot
TEMP
TMP
USERDOMAIN
USERNAME
USERPROFILE
windir
If you wish to dump all of the environment variables, this simple piece
of code will work:
For i = 1 To 26
Debug.Print Environ(i) & vbCrLf
Next i
------------------------------------------------------
Thanks, Kris. For your interest in SearchVB, we'll be sending you a
free denim shirt.
Kris McCann is a Senior Programmer/Designer for Europa Systems Ltd,
located in Vancouver, BC, Canada.
He has been programming in basic since 1987, and first picked up VB
back in '93. He has been programming in VB/VBA on a professional level
since 1997, and currently works for Europa Systems Ltd. in Vancouver,
Canada specializing in web application design and development.
------------------------------------------------------
Special Bonus Tip
Get quick access to your source code
Frank Silva
This is really more an organizational tip than a true VB tip, but it
has helped me greatly, especially in the field. By saving my code
snippets as Outlook Notes, I am able to download them to my Palm Pilot.
Therefore, anywhere I go, I can have access to my source code.
 |

|
|
 |
|
 |