Advertisement
7_2009-2012 Windows API Call/ Explanation #236813

Get Windows, System, User and Temp Directories

Functions to get the Windows Directory, System Directory, Temp Directory, and User Directory.

AI

ИИ-обзор: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Исходный код
original-source
'Get the windows directory
Public Function sWindowsDirectory() as String
 Dim sOut As String
 sOut = Space(260)
 GetWindowsDirectory sOut, 260
 sOut = Left(sOut, InStr(sOut, Chr(0)) - 1)
 sWindowsDirectory = sOut
End Function
'Get the system directory
Public Function sSystemDirectory() as String
 Dim sOut As String
 sOut = Space(260)
 GetSystemDirectory sOut, 260
 sOut = Left(sOut, InStr(sOut, Chr(0)) - 1)
 sSystemDirectory = sOut
End Function
'Get the temp directory
Public Function sTempDirectory() as String
 Dim sOut As String
 sOut = Space(260)
 ExpandEnvironmentStrings "%TEMP%", sOut, 260
 sOut = Left(sOut, InStr(sOut, Chr(0)) - 1)
 sTempDirectory = sOut
End Function
'Get the user directory
Public Function sUserDirectory() as String
 Dim sOut As String
 sOut = Space(260)
 ExpandEnvironmentStrings "%USERPROFILE%", sOut, 260
 sOut = Left(sOut, InStr(sOut, Chr(0)) - 1)
 sUserDirectory = sOut
End Function
Оригинальные комментарии (3)
Восстановлено из Wayback Machine