Titre: Vider la corbeille.
Description:
Comment vider la corbeille avec le message de confirmation et sans le message de confirmation.
Le code:
'VIDER LA CORBEILLE AVEC DEMANDE DE CONFIRMATION: Option Explicit Private Declare Function SHEmptyRecycleBin Lib "shell32.dll" Alias "SHEmptyRecycleBinA" (ByVal hwnd As Long, ByVal pszRootPath As String, ByVal dwFlags As Long) As Long Private Declare Function SHUpdateRecycleBinIcon Lib "shell32.dll" () As Long Private Sub CmdVider_Click() 'La vide SHEmptyRecycleBin Me.hwnd, vbNullString, 0 'La met à jour SHUpdateRecycleBinIcon End Sub 'VIDER LA CORBEILLE SANS CONFIRMATION: Option Explicit Private Declare Function SHEmptyRecycleBin Lib "shell32.dll" Alias "SHEmptyRecycleBinA" ( _ ByVal hwnd As Long, _ ByVal pszRootPath As String, _ ByVal dwFlags As Long) As Long 'Annuuler la boite de dialogue de confirmation Private Const SHERB_NOCONFIRMATION = &H1 'Annuler la boire de dialogue de progression de suppression Private Const SHERB_NOPROGRESSUI = &H2 'Annuler le son à la fin de la suppression Private Const SHERB_NOSOUND = &H4 Private Sub CmdVider_Click() SHEmptyRecycleBin 0, vbNullString, SHERB_NOCONFIRMATION End Sub |