Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
XML RSS Feed
 
 
 
 
 
 
 
 
Old Pages
 
Old Index
Site Map
What's New
 
Books
How To
Tips & Tricks
Tutorials
Stories
Performance
Essays
Links
Q & A
New in VB6
Free Stuff
Pictures
 
 
 
TitleFind the Windows directory without using the API
DescriptionThis example shows how to find the Windows directory without using the API in Visual Basic 6. It reads the file C:\MSDOS.SYS and looks for the windir= assignment.
KeywordsWindows directory, Windows, WinDir
CategoriesSoftware Engineering, Files and Directories, API
 
Thanks to Pablo Handler.

The prorgam opens the file C:\MSDOS.SYS and looks for the windir= assignment.

 
Private Sub Form_Load()
Dim FF As Integer
Dim LINE As String

    FF = FreeFile
    Open "C:\MSDOS.SYS" For Input As FF
    Do
        Line Input #FF, LINE
    Loop While InStr(1, LCase$(LINE), "windir=", 1) = 0
    Close FF

    Label2.Caption = Mid(LINE, 8)
End Sub
 
 
Copyright © 1997-2003 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated