vha API kald og en tilhørende funktion:
Se evt. de 3 nedstående eksempler på hhv. Windows, Windows System og Temp
bibliotekerne.
Private Declare Function GetWindowsDirectory Lib "kernel32" Alias
"GetWindowsDirectoryA" _
(ByVal lpBuffer As String, ByVal nSize As Long) As Long
Private Declare Function GetSystemDirectory Lib "kernel32" Alias
"GetSystemDirectoryA" _
(ByVal lpBuffer As String, ByVal nSize As Long) As Long
Private Declare Function GetTempPath Lib "kernel32" Alias "GetTempPathA" _
(ByVal nSize As Long, ByVal lpBuffer As String) As Long
Public Function GetWinDir() As String
Dim r As Long, nSize As Long
Dim Tmp As String
' pad the string for the return value and set nSize equal to the size of the
string
Tmp = Space$(256)
nSize = Len(Tmp)
' call the API
r = GetWindowsDirectory(Tmp, nSize)
' trim off the trailing chr$(0) added by the API
GetWinDir = TrimNull(Tmp)
End Function
Public Function GetSystemDir() As String
Dim r As Long, nSize As Long
Dim Tmp As String
Tmp = Space$(256)
nSize = Len(Tmp)
r = GetSystemDirectory(Tmp, nSize)
GetSystemDir = TrimNull(Tmp)
End Function
Public Function GetTempDir() As String
Dim r As Long, nSize As Long
Dim Tmp As String
Tmp = Space$(256)
nSize = Len(Tmp)
r = GetTempPath(nSize, Tmp)
GetTempDir = TrimNull(Tmp)
End Function
mvh
Niels
"Dondata" <tim_data@hotmail.com> skrev i en meddelelse
news:90pe9i$a1r$1@news.cybercity.dk...
> Hvordan finder man windows bilblioteket.
>
> I windows 95/98/98SE hedder det jo "Windows"
>
> Og i Windows NT 2000 hedder det "Winnt"
>
>
>
|