OVH Cloud OVH Cloud

Fichers Tmp.

3 réponses
Avatar
Guillaume
Bonjour à tous.

Je voudrai faire un p'tit prog qui efface le contenu du répertoire Temp et
Temporay Internet File de Windows.

Mais voilà ... Ces chemins sont différents selon W95/98 et NT ...

Comment faire ??

Merci de votre aide .

3 réponses

Avatar
jmn
Sous vb6, la fonction environ("nom_du_paramètre_systeme") permet d'obtenir
le contenu des variables TEMP et/ou TMP...
Avatar
François Picalausa
Bonjour/soir,

il y a une fiche de la faq a ce sujet:

http://faq.vb.free.fr/index.php?question…

--
François Picalausa (MVP VB)
FAQ VB : http://faq.vb.free.fr
MSDN : http://msdn.microsoft.com


"Guillaume" <not> a écrit dans le message de
news:O5%
Bonjour à tous.

Je voudrai faire un p'tit prog qui efface le contenu du répertoire
Temp et Temporay Internet File de Windows.

Mais voilà ... Ces chemins sont différents selon W95/98 et NT ...

Comment faire ??

Merci de votre aide .


Avatar
ng
Salut,

Pour le temporary files, utilise ce code :

Const CSIDL_DESKTOP = &H0
Const CSIDL_PROGRAMS = &H2
Const CSIDL_CONTROLS = &H3
Const CSIDL_PRINTERS = &H4
Const CSIDL_PERSONAL = &H5
Const CSIDL_FAVORITES = &H6
Const CSIDL_STARTUP = &H7
Const CSIDL_RECENT = &H8
Const CSIDL_SENDTO = &H9
Const CSIDL_BITBUCKET = &HA
Const CSIDL_STARTMENU = &HB
Const CSIDL_DESKTOPDIRECTORY = &H10
Const CSIDL_DRIVES = &H11
Const CSIDL_NETWORK = &H12
Const CSIDL_NETHOOD = &H13
Const CSIDL_FONTS = &H14
Const CSIDL_TEMPLATES = &H15
Const CSIDL_INTERNET_TEMP = 32
Const MAX_PATH = 260
Private Type SHITEMID
cb As Long
abID As Byte
End Type
Private Type ITEMIDLIST
mkid As SHITEMID
End Type
Private Declare Function ShellAbout Lib "shell32.dll" Alias "ShellAboutA"
(ByVal hWnd As Long, ByVal szApp As String, ByVal szOtherStuff As String,
ByVal hIcon As Long) As Long
Private Declare Function SHGetSpecialFolderLocation Lib "shell32.dll" (ByVal
hwndOwner As Long, ByVal nFolder As Long, pidl As ITEMIDLIST) As Long
Private Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias
"SHGetPathFromIDListA" (ByVal pidl As Long, ByVal pszPath As String) As Long

Private Function GetSpecialfolder(CSIDL As Long) As String
Dim r As Long
Dim IDL As ITEMIDLIST
'Get the special folder
r = SHGetSpecialFolderLocation(100, CSIDL, IDL)
If r = NOERROR Then
'Create a buffer
Path$ = Space$(512)
'Get the path from the IDList
r = SHGetPathFromIDList(ByVal IDL.mkid.cb, ByVal Path$)
'Remove the unnecessary chr$(0)'s
GetSpecialfolder = Left$(Path, InStr(Path, Chr$(0)) - 1)
Exit Function
End If
GetSpecialfolder = ""
End Function


Debug.Print GetSpecialfolder(CSIDL_INTERNET_TEMP)


--
Nicolas.
http://www.ngsoft-fr.com
"Guillaume" <not> a écrit dans le message de news:
O5#
Bonjour à tous.

Je voudrai faire un p'tit prog qui efface le contenu du répertoire Temp et
Temporay Internet File de Windows.

Mais voilà ... Ces chemins sont différents selon W95/98 et NT ...

Comment faire ??

Merci de votre aide .