The most important of all directories in my opinion is the System Directory.
Its vital that you dont simply use "C:\Windows\System32
" or something
like that if you want to get your application to work in all platforms.
So heres another snippet for your enjoyment: Option Explicit
Private Declare Function GetSystemDirectoryB Lib "kernel32" Alias "GetSystemDirectoryA"
(ByVal Path As String, ByVal cbBytes As Long) As Long
Private Const MAX_LENGTH = 512
Public Function GetWindowsSystemDirectory() As String
Dim s As String
Dim c As Long
s = String$(MAX_LENGTH, 0)
c = GetSystemDirectoryB(s, MAX_LENGTH)
If c > 0 Then
If c > Len(s) Then
s = Space$(c + 1)
c = GetSystemDirectoryB(s, MAX_LENGTH)
End If
End If
GetWindowsSystemDirectory = IIf(c > 0, Left$(s, c), "")
End Function
So going back to our example used before, to read say the oohhhhh so important
EULA from Microsoft for your Windoze operating system: Dim iFileNum As Integer
Dim strEULA as string
iFileNum = FreeFile
Open GetWindowsSystemDirectory& "eula.txt" For Input As iFileNum
strEULA = Input$(LOF(iFileNum), iFileNum)
Close #iFileNum
msgbox strEULA, vbCritical, "UnImportant Aggreement"
Click 'Next>>' and dont collect the $100...
Comments