Ähnlich dem von "freak" in C# aber mit Besonderen Ordnern ;)
Public Enum SpecialFolders
Windows = 0
Programme
Desktop
Startmenue
EigeneDateien
Schnellstart
End Enum
Public Function GetSpecialFolders(ByVal SF As SpecialFolders) As String
GetSpecialFolders = ""
Select Case SF
Case SpecialFolders.Desktop
GetSpecialFolders = My.Computer.FileSystem.SpecialDirectories.Desktop
Case SpecialFolders.Programme
GetSpecialFolders = My.Computer.FileSystem.SpecialDirectories.Programs
Case SpecialFolders.Startmenue
GetSpecialFolders = System.Environment.GetEnvironmentVariable("HOMEDRIVE")
GetSpecialFolders += System.Environment.GetEnvironmentVariable("HOMEPATH")
GetSpecialFolders += "\Startmenü\Programme"
Case SpecialFolders.Schnellstart
GetSpecialFolders = System.Environment.GetEnvironmentVariable("HOMEDRIVE")
GetSpecialFolders += System.Environment.GetEnvironmentVariable("HOMEPATH")
GetSpecialFolders += "\Anwendungsdaten\Microsoft\Internet Explorer\Quick Launch"
Case SpecialFolders.EigeneDateien
GetSpecialFolders = My.Computer.FileSystem.SpecialDirectories.MyDocuments
Case SpecialFolders.Windows
GetSpecialFolders = System.Environment.GetEnvironmentVariable("SystemRoot")
End Select
If My.Computer.FileSystem.DirectoryExists(GetSpecialFolders) = False Then Return ""
Return GetSpecialFolders
End Function
2 Kommentare zum Snippet