Results 1 to 4 of 4

Thread: Finding root in windows through VB

  1. #1

    Thread Starter
    Hyperactive Member deane034's Avatar
    Join Date
    May 2001
    Location
    Sri Lanka
    Posts
    485

    Finding root in windows through VB

    hi, does anyone know how to get the root directry in windows, for eg: my root dir is C:\windows\
    but this can change, there can be instances when the root is d:\windows or D:\windows.000\ or E:\windows, how can i determine this through VB?
    thanx

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  3. #3
    PowerPoster jdc2000's Avatar
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    2,526
    The following code will return the Windows directory:

    Declare Function GetWindowsDirectory Lib "Kernel32" Alias "GetWindowsDirectoryA" (ByVal strWinDir As String, ByVal dblListLen As Long) As Long

    strWinDir = String$(255, Chr$(0))

    lngListLen = GetWindowsDirectory(strWinDir, Len(strWinDir))
    strWinDir = Left$(strWinDir, lngListLen)
    If Right$(strWinDir, 1) <> "\" Then strWinDir = strWinDir + "\"

  4. #4

    Thread Starter
    Hyperactive Member deane034's Avatar
    Join Date
    May 2001
    Location
    Sri Lanka
    Posts
    485
    thanx a trill

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width