Atlanta Custom Software Development 

 
   Search        Code/Page
 

User Login
Email

Password

 

Forgot the Password?
Services
» Web Development
» Maintenance
» Data Integration/BI
» Information Management
Programming
  Database
Automation
OS/Networking
Graphics
Links
Tools
» Regular Expr Tester
» Free Tools

Tip: How to display all environment variables
[ All Languages » VB »  Windows]

Total Hit ( 2507)

Rate this article:     Poor     Excellent 

 Submit Your Question/Comment about this article

Rating


 


Click here to copy the following block
Private Declare Function GetEnvironmentStrings Lib "kernel32" Alias "GetEnvironmentStringsA" () As Long
Private Declare Function FreeEnvironmentStrings Lib "kernel32" Alias "FreeEnvironmentStringsA" (ByVal lpsz As String) As Long
Private Declare Function lstrlen Lib "kernel32" Alias "lstrlenA" (ByVal lpString As Long) As Long
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (lpvDest As Any, lpvSource As Any, ByVal cbCopy As Long)
Private Sub Form_Load()
  Dim lngRet As Long, strDest As String, lLen As Long
  Dim strtemp As String
  Me.AutoRedraw = True

  'retrieve the initial pointer to the environment strings
  lngRet = GetEnvironmentStrings
  Do
    'get the length of the following string
    lLen = lstrlen(lngRet)
    'if the length equals 0, we've reached the end
    If lLen = 0 Then Exit Do
    'create a buffer string
    strDest = Space$(lLen)
    'copy the text from the environment block
    CopyMemory ByVal strDest, ByVal lngRet, lLen
    'show the text
    strtemp = strtemp & Replace(strDest, Chr(0), "") & vbCrLf
    'move the pointer
    lngRet = lngRet + lstrlen(lngRet) + 1
  Loop

  'clean up
  FreeEnvironmentStrings lngRet

  MsgBox strtemp
End Sub


Submitted By : Nayan Patel  (Member Since : 5/26/2004 12:23:06 PM)

Job Description : He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting.
View all (893) submissions by this author  (Birth Date : 7/14/1981 )


Home   |  Comment   |  Contact Us   |  Privacy Policy   |  Terms & Conditions   |  BlogsZappySys

© 2008 BinaryWorld LLC. All rights reserved.