VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Retrieve System Info

by Bharat Nagarajan (2 Submissions)
Category: Windows System Services
Compatability: Visual Basic 5.0
Difficulty: Advanced
Date Added: Wed 3rd February 2021
Rating: (4 Votes)

Retrieves System Information in a single line of code

Assumes
To retrieve system info we use all kinda code but there is a function in VB 6.0 called Environ() which takes in a single parameter which makes our lives bit easy. Like if you want to know the users Temporary Directory or System Directory via VB 6.0
Code Returns
System Information

Rate Retrieve System Info

Private Sub cmdSysInfo_Click()
'Will popup a message box displaying your computer name
 MsgBox(environ("computername"))
'Like that we can get it for the variables like
    '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()
End Sub

Download this snippet    Add to My Saved Code

Retrieve System Info Comments

No comments have been posted about Retrieve System Info. Why not be the first to post a comment about Retrieve System Info.

Post your comment

Subject:
Message:
0/1000 characters