Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionDim Buffer() As Byte Dim Lg As Long Dim Total As Long Dim Reste As Long for i = 1 to n Nomentre = NomduFichier(i) Nomsortie = NomenSortie(i) Total = Longueur(i) Reste = Total Lg = 4096 ReDim Buffer(Lg - 1) Open Nomentre For Binary As #1 Open Nomsortie For Binary As #2 While Reste > 0 If Reste < Lg Then Lg = Reste: ReDim Buffer(Lg - 1) Get #1, , Buffer() Reste = Reste - Lg Totalcopié = Totalcopié + Lg ProgressBar1.Value = Totalcopiée * 100 / TotalGénéral DoEvents Put #2, , Buffer() Wend Close #2 Close #1 next
Option Explicit 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 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 GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long Private Declare Function fCreateShellLink Lib "VB5STKIT.DLL" (ByVal lpstrFolderName As String, ByVal lpstrLinkName As String, ByVal lpstrLinkPath As String, ByVal lpstrLinkArgs As String) 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 Sub Command1_Click() Dim sSave As String Dim Rep As Long 'ici tu trouves le répertoire systéme sSave = Space(255) Rep = GetSystemDirectory(sSave, 255) sSave = Left$(sSave, Rep) MsgBox "Windows System directory= " & sSave 'plus simple le répertoire windows MsgBox Environ$("Windir") End Sub Private Sub Command2_Click() Dim Rep As Long Dim c As String Dim s As String 'pour créer un raccourci c = GetSpecialfolder(CSIDL_DESKTOP) c = "..\.." & Mid$(c, InStrRev(c, "") + 1) s = "C:\INSTALL\TOTO.EXE" Rep = fCreateShellLink(c, "LINK", s, "") MsgBox Rep 'si rep différent de zéro c'est bon End Sub Private Function GetSpecialfolder(CSIDL As Long) As String Dim Rep As Long Dim IDL As ITEMIDLIST Dim path As String 'Get the special folder Rep = SHGetSpecialFolderLocation(100, CSIDL, IDL) If Rep = 0 Then path = Space$(512) 'Get the path from the IDList Rep = SHGetPathFromIDList(ByVal IDL.mkid.cb, ByVal path) 'Remove the unnecessary chr$(0)'s GetSpecialfolder = Left$(path, InStr(path, Chr$(0)) - 1) Else GetSpecialfolder = "" End If End Function