VB.NET et les dossier speciaux

RJLFRANCE Messages postés 71 Date d'inscription samedi 17 août 2002 Statut Membre Dernière intervention 5 août 2012 - 10 janv. 2004 à 12:32
tchoucky Messages postés 48 Date d'inscription lundi 17 novembre 2003 Statut Membre Dernière intervention 1 septembre 2006 - 28 nov. 2005 à 13:51
Bonjour
Comment trouver les dossier speciaux en vb.net
telle que Bureau,Mes documents,...
Merci

3 réponses

RJLFRANCE Messages postés 71 Date d'inscription samedi 17 août 2002 Statut Membre Dernière intervention 5 août 2012 1
10 janv. 2004 à 14:52
J'ai trouver la reponse, sa peut servir a d'autre .

Dim dossier As String
dossier = Environment.GetFolderPath_(Environment.SpecialFolder.DesktopDirectory)
TextBox1.Text = dossier

voila
0
cs_BFR Messages postés 88 Date d'inscription mardi 30 juillet 2002 Statut Membre Dernière intervention 1 mars 2008
10 janv. 2004 à 16:07
c'est un module de classe de tous les dossiers spéciaux

Public Class DossiersSpeciaux
'-Retourne le chemin des dossiers Spéciaux
'-Appel:
'Dim ObjFolder As New DossiersSpeciaux
'Dim PathDossierFavoris As String = ObjFolder.FavoritesPath
Public Class LocalUserFolders

'-Déclaration
Dim Reg As Microsoft.Win32.Registry

Public Function AppDataPath() As String

Return Reg.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("AppData")

End Function

Public Function CookiesPath() As String

Return Reg.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("Cookies")

End Function

Public Function DesktopPath() As String

Return Reg.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("Desktop")

End Function

Public Function FavoritesPath() As String

Return Reg.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("Favorites")

End Function
Public Function NetHoodPath() As String

Return Reg.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("NetHood")

End Function

Public Function PersonalPath() As String

Return Reg.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("Personal")

End Function

Public Function PrintHoodPath() As String

Return Reg.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("PrintHood")

End Function

Public Function RecentPath() As String

Return Reg.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("Recent")

End Function

Public Function SendToPath() As String

Return Reg.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("SendTo")

End Function

Public Function StartMenuPath() As String

Return Reg.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("Start Menu")

End Function

Public Function TemplatesPath() As String

Return Reg.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("Templates")

End Function

Public Function ProgramsPath() As String

Return Reg.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("Programs")

End Function

Public Function StartupPath() As String

Return Reg.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("Startup")

End Function

Public Function LocalSettingsPath() As String

Return Reg.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("Local Settings")

End Function

Public Function LocalAppDataPath() As String

Return Reg.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("Local AppData")

End Function

Public Function CachePath() As String

Return Reg.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("Cache")

End Function

Public Function HistoryPath() As String

Return Reg.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("History")

End Function

Public Function MyPicturesPath() As String

Return Reg.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("My Pictures")

End Function

Public Function FontsPath() As String

Return Reg.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("Fonts")

End Function

Public Function MyMusicPath() As String

Return Reg.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("My Music")

End Function

End Class

Public Class DefaultUserFolders

Public reg As Microsoft.Win32.Registry
Public Function AppDataPath() As String

Return reg.Users.OpenSubKey(".DEFAULT\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("AppData")

End Function

Public Function CookiesPath() As String

Return reg.Users.OpenSubKey(".DEFAULT\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("Cookies")

End Function

Public Function DesktopPath() As String

Return reg.Users.OpenSubKey(".DEFAULT\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("Desktop")

End Function

Public Function FavoritesPath() As String

Return reg.Users.OpenSubKey(".DEFAULT\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("Favorites")

End Function
Public Function NetHoodPath() As String

Return reg.Users.OpenSubKey(".DEFAULT\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("NetHood")

End Function

Public Function PersonalPath() As String

Return reg.Users.OpenSubKey(".DEFAULT\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("Personal")

End Function

Public Function PrintHoodPath() As String

Return reg.Users.OpenSubKey(".DEFAULT\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("PrintHood")

End Function

Public Function RecentPath() As String

Return reg.Users.OpenSubKey(".DEFAULT\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("Recent")

End Function

Public Function SendToPath() As String

Return reg.Users.OpenSubKey(".DEFAULT\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("SendTo")

End Function

Public Function StartMenuPath() As String

Return reg.Users.OpenSubKey(".DEFAULT\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("Start Menu")

End Function

Public Function TemplatesPath() As String

Return reg.Users.OpenSubKey(".DEFAULT\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("Templates")

End Function

Public Function ProgramsPath() As String

Return reg.Users.OpenSubKey(".DEFAULT\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("Programs")

End Function

Public Function StartupPath() As String

Return reg.Users.OpenSubKey(".DEFAULT\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("Startup")

End Function

Public Function LocalSettingsPath() As String

Return reg.Users.OpenSubKey(".DEFAULT\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("Local Settings")

End Function

Public Function LocalAppDataPath() As String

Return reg.Users.OpenSubKey(".DEFAULT\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("Local AppData")

End Function

Public Function CachePath() As String

Return reg.Users.OpenSubKey(".DEFAULT\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("Cache")

End Function

Public Function HistoryPath() As String

Return reg.Users.OpenSubKey(".DEFAULT\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("History")

End Function

Public Function MyPicturesPath() As String

Return reg.Users.OpenSubKey(".DEFAULT\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("My Pictures")

End Function

Public Function FontsPath() As String

Return reg.Users.OpenSubKey(".DEFAULT\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("Fonts")

End Function

Public Function MyMusicPath() As String

Return reg.Users.OpenSubKey(".DEFAULT\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("My Music")

End Function

End Class

Public Class CommonFolders
Public reg As Microsoft.Win32.Registry
Public Function CommonAdministrativeToolsPath() As String

Return reg.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("Common Administrative Tools")

End Function

Public Function CommonAppDataPath() As String

Return reg.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("Common AppData")

End Function

Public Function CommonDesktopPath() As String

Return reg.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("Common Desktop")

End Function

Public Function CommonDocumentsPath() As String

Return reg.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("Common Desktop")

End Function

Public Function CommonFavoritesPath() As String

Return reg.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("Common Favorites")

End Function

Public Function CommonProgramsPath() As String

Return reg.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("Common Programs")

End Function

Public Function CommonStartMenuPath() As String

Return reg.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("Common Start Menu")

End Function

Public Function CommonStartupPath() As String

Return reg.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("Common Startup")

End Function

Public Function CommonTemplatesPath() As String

Return reg.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("CommonTemplates")

End Function

Public Function CommonMusicPath() As String

Return reg.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("CommonMusic")

End Function

Public Function CommonPicturesPath() As String

Return reg.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("CommonPictures")

End Function

Public Function CommonVideoPath() As String

Return reg.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("CommonVideo")

End Function

Public Function PersonalPath() As String

Return reg.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders").GetValue("Personal")

End Function

End Class

Public Class OtherWindowsFolders
Public reg As Microsoft.Win32.Registry
Public Function GetCommonFilesPath() As String

Return reg.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion").GetValue("CommonFilesDir")

End Function

Public Function ProgramFilesPath() As String

Return reg.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion").GetValue("ProgramFilesDir")

End Function
Public Function MediaPathPath() As String

Return reg.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion").GetValue("MediaPath")

End Function
End Class

Public Class WindowsNTValues
Public reg As Microsoft.Win32.Registry
Public Function GetProductNameValues() As String

Return reg.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion").GetValue("ProductName")

End Function

Public Function WindowsProductName() As String

Return reg.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion").GetValue("ProductName")

End Function

Public Function RegisteredOrganization() As String

Return reg.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion").GetValue("RegisteredOrganization")

End Function

Public Function RegisteredOwner() As String

Return reg.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion").GetValue("RegisteredOwner")

End Function

Public Function CurrentVersion() As String

Return reg.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion").GetValue("CurrentVersion")

End Function

Public Function CurrentBuildNumber() As String

Return reg.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion").GetValue("CurrentBuildNumber")

End Function

Public Function SystemRoot() As String

Return reg.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion").GetValue("SystemRoot")

End Function

Public Function SubVersionNumber() As String

Return reg.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion").GetValue("SubVersionNumber")

End Function

Public Function CSDVersion() As String

Return reg.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion").GetValue("CSDVersion")

End Function

End Class

End Class

Salutations
A++BFR
0
tchoucky Messages postés 48 Date d'inscription lundi 17 novembre 2003 Statut Membre Dernière intervention 1 septembre 2006 2
28 nov. 2005 à 13:51
il y a une erreur sur la fonction CommonDocumentsPath, il faut remplacer Common Desktop par Common Documents:





Public Function CommonDocumentsPath() As String



Return
reg.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell
Folders").GetValue("Common Desktop")



End Function
0
Rejoignez-nous