![]() |
Tipp 0131
|
Systemverzeichnis ermitteln
|
 |
|
Autor/Einsender: Datum: |
|
Daniel Fiedler 26.09.2001 |
|
Entwicklungsumgebung: |
|
VB 5 |
|
|
Mithilfe der API-Funktion GetSystemDirectory ist es möglich, recht einfach
und mit wenigen Handgriffen das Systemverzeichnis des Betriebssystems herauszufinden.
|
|
|
Option Explicit
Private Declare Function GetSystemDirectory Lib "kernel32" _
Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, _
ByVal nSize As Long) As Long
Function GetSysDir() As String
Dim strDir As String
Dim nLen As Long
strDir = Space(255)
nLen = GetSystemDirectory(strDir, 255)
strDir = Left(strDir, nLen)
If Right$(strDir, 1) <> "\" Then strDir = strDir & "\"
GetSysDir = strDir
End Function
|
|
|
|
|
MsgBox "Systemverzeichnis: " & GetSysDir
|
|
|
|
|
|
Der hier abgebildete Code funktioniert auch in einem VBA-Projekt, dieser muss dazu
lediglich in den VB-Editor der entsprechenden Anwendung kopiert werden. Ein Import
der im Download enthaltenen *.frm-Datei ist nicht möglich.
|
|
Windows-Version |
95 |
 |
|
98/SE |
 |
|
ME |
 |
|
NT |
 |
|
2000 |
 |
|
XP |
 |
|
Vista |
 |
|
Win
7 |
 |
|
|
VB-Version |
VBA 5 |
 |
|
VBA 6 |
 |
|
VB 4/16 |
 |
|
VB 4/32 |
 |
|
VB 5 |
 |
|
VB 6 |
 |
|
|
|
Download (1,8 kB)
|
Downloads bisher: [ 1407 ]
|
|
|