Problemstellung:
Wie ermittle ich das Windows-Verzeichnis?
Mit API
Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" _ (ByVal lpBuffer As String, ByVal nSize As Long) As Long Function GetWindowsDir() As String '******************************************* 'Name: GetWindowsDir (Function) 'Purpose: ermittelt das aktuelle Windowsverzeichnis 'Author: Thomas Keßler 'Date: Januar 28, 2003, 05:02:21 'Inputs: 'Output: '******************************************* Dim Ret As Long Dim strBuffer As String, lLength As Long strBuffer = String$(255, 0) lLength = Len(strBuffer) Ret = GetWindowsDirectory(strBuffer, lLength) If Ret <> 0 Then GetWindowsDir = Left$(strBuffer, Ret) End Function
Aufruf:
Dim x As String x = GetWindowsDir()
Das Ergebniswäre x = "C:\WINDOWS"
Ähnliche Artikel
Weiterlesen...