Home > Microsoft .Net Development Tips > ARCHIVE: Tips & Tricks > Quick system info retrieval
Win Development Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

ARCHIVE: TIPS & TRICKS

Quick system info retrieval


Kris McCann
02.13.2001
Rating: -4.67- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


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.

Rate this Tip
To rate tips, you must be a member of SearchWinDevelopment.com.
Register now to start rating these tips. Log in if you are already a member.


Submit a Tip




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
ARCHIVE: Tips & Tricks
SearchVB wants your tips
Find out what VS.NET modules are installed
Retrieving icons from an EXE-file
Toggling Boolean values
VS.NET multiple tabbed windows
Set the value of a DataField in code behind
Easy grid design
Open using last Visual Studio.NET layout
Save development time by using inherited forms
Reusing code in VS.NET

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



Database Programming Solutions - .NET XML, Visual Studio LINQ, ORM .NET
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2000 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts