Declare Function GetWindowsDirectory& Lib "kernel32" _
Alias "GetWindowsDirectoryA" (ByVal P$, ByVal S%)
Declare Function GetSystemDirectory& Lib "kernel32" _
Alias "GetSystemDirectoryA" (ByVal P$, ByVal S%)
Potem już tylko zostaje odczytać odpowiednie katalogi w następujący sposób:
Function KatalogWindows()
'Odczytuje ścieżkę do katalogu Windows
Dim strDirPath As String, LenDir As Integer
strDirPath = String$(145, Chr$(0))
LenDir = GetWindowsDirectory(strDirPath, Len(strDirPath))
KatalogWindows = Left(strDirPath, LenDir)
End Function
Function KatalogSystem()
'Odczytuje ścieżkę do katalogu System
Dim strDirPath As String, LenDir As Integer
strDirPath = String$(145, Chr$(0))
LenDir = GetSystemDirectory&(strDirPath, Len(strDirPath))
KatalogSystem = Left(strDirPath, LenDir)
End Function
K. P.