Call Shell(Environ$("COMSPEC") & " /c @echo o | format a: /q", vbHide)
OU
Call Shell("format_a.bat", vbHide)
PUIS
copies de fichier de c sur a...
Le problème, c'est shell étant une fonction asynchrone, le formatage n'a
pas le temps de se faire, il est annulé par la suite de la copie, alors à
part mette un timer, où une validation MsgBox de formatage, que voyez-vous
comme solution ???
Nb, hier ça marchait, mais j'ai remanié mon code, et ça coince, voici:
Dim ordre As String
Dim source As String
Dim cible As String
'
Screen.MousePointer = vbHourglass
ordre = "@echo o | format a:/q"
pf13 = FreeFile
Open "format_a.bat" For Output As pf13
Print #pf13, ordre
Close pf13
'
'Call Shell(Environ$("COMSPEC") & " /c @echo o | format a: /q", vbHide)
Call Shell("format_a.bat", vbHide)
'
On Error GoTo erreur
source = App.Path & "\Noms_C.txt"
cible = "a:\Noms_C.txt"
FileCopy source, cible
source = App.Path & "\Libel_C.txt"
cible = "a:\Libel_C.txt"
FileCopy source, cible
'
For i = 0 To List2.ListCount - 1
source = App.Path & "\" & List2.List(i) & "_C.txt"
cible = "a:\" & List2.List(i) & "_C.txt"
FileCopy source, cible
Next i
??????????????
Merci, au revoir et à bientôt.
--
ng75 arobase noos.fr
------------------------------------------------------------
LE TROLL, éleveur de trolls depuis César, qui disait :
Avec une hache, celui qui tient le manche a toujours raison !
Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
ng
Salut,
Hop, une petite recherche qqes jours en arrière et on trouve : http://groups.google.fr/groups?q=ShellAndWait+author:ng&hl=fr&lr=&selm=OAMNRBa6EHA.796%40TK2MSFTNGP09.phx.gbl&rnum=1
-- Nicolas G. FAQ VB : http://faq.vb.free.fr API Guide : http://www.allapi.net Google Groups : http://groups.google.fr/ MZ-Tools : http://www.mztools.com/
LE TROLL wrote:
Bonjour,
J'ai un:
Call Shell(Environ$("COMSPEC") & " /c @echo o | format a: /q", vbHide) OU Call Shell("format_a.bat", vbHide) PUIS copies de fichier de c sur a...
Le problème, c'est shell étant une fonction asynchrone, le formatage n'a pas le temps de se faire, il est annulé par la suite de la copie, alors à part mette un timer, où une validation MsgBox de formatage, que voyez-vous comme solution ???
Nb, hier ça marchait, mais j'ai remanié mon code, et ça coince, voici:
Dim ordre As String Dim source As String Dim cible As String ' Screen.MousePointer = vbHourglass ordre = "@echo o | format a:/q" pf13 = FreeFile Open "format_a.bat" For Output As pf13 Print #pf13, ordre Close pf13 ' 'Call Shell(Environ$("COMSPEC") & " /c @echo o | format a: /q", vbHide) Call Shell("format_a.bat", vbHide) ' On Error GoTo erreur source = App.Path & "Noms_C.txt" cible = "a:Noms_C.txt" FileCopy source, cible source = App.Path & "Libel_C.txt" cible = "a:Libel_C.txt" FileCopy source, cible ' For i = 0 To List2.ListCount - 1 source = App.Path & "" & List2.List(i) & "_C.txt" cible = "a:" & List2.List(i) & "_C.txt" FileCopy source, cible Next i
??????????????
Merci, au revoir et à bientôt.
Salut,
Hop, une petite recherche qqes jours en arrière et on trouve :
http://groups.google.fr/groups?q=ShellAndWait+author:ng&hl=fr&lr=&selm=OAMNRBa6EHA.796%40TK2MSFTNGP09.phx.gbl&rnum=1
--
Nicolas G.
FAQ VB : http://faq.vb.free.fr
API Guide : http://www.allapi.net
Google Groups : http://groups.google.fr/
MZ-Tools : http://www.mztools.com/
LE TROLL wrote:
Bonjour,
J'ai un:
Call Shell(Environ$("COMSPEC") & " /c @echo o | format a: /q",
vbHide) OU
Call Shell("format_a.bat", vbHide)
PUIS
copies de fichier de c sur a...
Le problème, c'est shell étant une fonction asynchrone, le
formatage n'a pas le temps de se faire, il est annulé par la suite de
la copie, alors à part mette un timer, où une validation MsgBox de
formatage, que voyez-vous comme solution ???
Nb, hier ça marchait, mais j'ai remanié mon code, et ça coince, voici:
Dim ordre As String
Dim source As String
Dim cible As String
'
Screen.MousePointer = vbHourglass
ordre = "@echo o | format a:/q"
pf13 = FreeFile
Open "format_a.bat" For Output As pf13
Print #pf13, ordre
Close pf13
'
'Call Shell(Environ$("COMSPEC") & " /c @echo o | format a: /q",
vbHide) Call Shell("format_a.bat", vbHide)
'
On Error GoTo erreur
source = App.Path & "Noms_C.txt"
cible = "a:Noms_C.txt"
FileCopy source, cible
source = App.Path & "Libel_C.txt"
cible = "a:Libel_C.txt"
FileCopy source, cible
'
For i = 0 To List2.ListCount - 1
source = App.Path & "" & List2.List(i) & "_C.txt"
cible = "a:" & List2.List(i) & "_C.txt"
FileCopy source, cible
Next i
Hop, une petite recherche qqes jours en arrière et on trouve : http://groups.google.fr/groups?q=ShellAndWait+author:ng&hl=fr&lr=&selm=OAMNRBa6EHA.796%40TK2MSFTNGP09.phx.gbl&rnum=1
-- Nicolas G. FAQ VB : http://faq.vb.free.fr API Guide : http://www.allapi.net Google Groups : http://groups.google.fr/ MZ-Tools : http://www.mztools.com/
LE TROLL wrote:
Bonjour,
J'ai un:
Call Shell(Environ$("COMSPEC") & " /c @echo o | format a: /q", vbHide) OU Call Shell("format_a.bat", vbHide) PUIS copies de fichier de c sur a...
Le problème, c'est shell étant une fonction asynchrone, le formatage n'a pas le temps de se faire, il est annulé par la suite de la copie, alors à part mette un timer, où une validation MsgBox de formatage, que voyez-vous comme solution ???
Nb, hier ça marchait, mais j'ai remanié mon code, et ça coince, voici:
Dim ordre As String Dim source As String Dim cible As String ' Screen.MousePointer = vbHourglass ordre = "@echo o | format a:/q" pf13 = FreeFile Open "format_a.bat" For Output As pf13 Print #pf13, ordre Close pf13 ' 'Call Shell(Environ$("COMSPEC") & " /c @echo o | format a: /q", vbHide) Call Shell("format_a.bat", vbHide) ' On Error GoTo erreur source = App.Path & "Noms_C.txt" cible = "a:Noms_C.txt" FileCopy source, cible source = App.Path & "Libel_C.txt" cible = "a:Libel_C.txt" FileCopy source, cible ' For i = 0 To List2.ListCount - 1 source = App.Path & "" & List2.List(i) & "_C.txt" cible = "a:" & List2.List(i) & "_C.txt" FileCopy source, cible Next i
??????????????
Merci, au revoir et à bientôt.
LE TROLL
Ça y est, merci, ça marche, j'ai fait ça:
Private Declare Function OpenProcess Lib "kernel32" _ (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, _ ByVal dwProcessId As Long) As Long Private Declare Function WaitForSingleObject Lib "kernel32" _ (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long Const SYNCHRONIZE = &H100000 Const INFINITE = &HFFFF
Call sauvegarde
Function ShellAndWait() As Boolean ' sauvegarde Dim idProc As Long Dim hProc As Long Dim iRet As Long Dim hNull As Long ' idProc = Shell(Environ$("COMSPEC") & " /c @echo o | format a: /q", vbHide) hProc = OpenProcess(SYNCHRONIZE, False, idProc) If hProc <> hNull Then iRet = WaitForSingleObject(hProc, INFINITE) CloseHandle hProc ShellAndWait = True End If If hProc = hNull Then ShellAndWait = False DoEvents End Function -----------
"ng" a écrit dans le message de news:
Salut,
Hop, une petite recherche qqes jours en arrière et on trouve : http://groups.google.fr/groups?q=ShellAndWait+author:ng&hl=fr&lr=&selm=OAMNRBa6EHA.796%40TK2MSFTNGP09.phx.gbl&rnum=1
-- Nicolas G. FAQ VB : http://faq.vb.free.fr API Guide : http://www.allapi.net Google Groups : http://groups.google.fr/ MZ-Tools : http://www.mztools.com/
LE TROLL wrote:
Bonjour,
J'ai un:
Call Shell(Environ$("COMSPEC") & " /c @echo o | format a: /q", vbHide) OU Call Shell("format_a.bat", vbHide) PUIS copies de fichier de c sur a...
Le problème, c'est shell étant une fonction asynchrone, le formatage n'a pas le temps de se faire, il est annulé par la suite de la copie, alors à part mette un timer, où une validation MsgBox de formatage, que voyez-vous comme solution ???
Nb, hier ça marchait, mais j'ai remanié mon code, et ça coince, voici:
Dim ordre As String Dim source As String Dim cible As String ' Screen.MousePointer = vbHourglass ordre = "@echo o | format a:/q" pf13 = FreeFile Open "format_a.bat" For Output As pf13 Print #pf13, ordre Close pf13 ' 'Call Shell(Environ$("COMSPEC") & " /c @echo o | format a: /q", vbHide) Call Shell("format_a.bat", vbHide) ' On Error GoTo erreur source = App.Path & "Noms_C.txt" cible = "a:Noms_C.txt" FileCopy source, cible source = App.Path & "Libel_C.txt" cible = "a:Libel_C.txt" FileCopy source, cible ' For i = 0 To List2.ListCount - 1 source = App.Path & "" & List2.List(i) & "_C.txt" cible = "a:" & List2.List(i) & "_C.txt" FileCopy source, cible Next i
??????????????
Merci, au revoir et à bientôt.
Ça y est, merci, ça marche, j'ai fait ça:
Private Declare Function OpenProcess Lib "kernel32" _
(ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, _
ByVal dwProcessId As Long) As Long
Private Declare Function WaitForSingleObject Lib "kernel32" _
(ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As
Long) As Long
Const SYNCHRONIZE = &H100000
Const INFINITE = &HFFFF
Call sauvegarde
Function ShellAndWait() As Boolean ' sauvegarde
Dim idProc As Long
Dim hProc As Long
Dim iRet As Long
Dim hNull As Long
'
idProc = Shell(Environ$("COMSPEC") & " /c @echo o | format a: /q", vbHide)
hProc = OpenProcess(SYNCHRONIZE, False, idProc)
If hProc <> hNull Then
iRet = WaitForSingleObject(hProc, INFINITE)
CloseHandle hProc
ShellAndWait = True
End If
If hProc = hNull Then ShellAndWait = False
DoEvents
End Function
-----------
"ng" <ng@ngsoft-fr.com> a écrit dans le message de news:
eoNfThm7EHA.3148@TK2MSFTNGP10.phx.gbl...
Salut,
Hop, une petite recherche qqes jours en arrière et on trouve :
http://groups.google.fr/groups?q=ShellAndWait+author:ng&hl=fr&lr=&selm=OAMNRBa6EHA.796%40TK2MSFTNGP09.phx.gbl&rnum=1
--
Nicolas G.
FAQ VB : http://faq.vb.free.fr
API Guide : http://www.allapi.net
Google Groups : http://groups.google.fr/
MZ-Tools : http://www.mztools.com/
LE TROLL wrote:
Bonjour,
J'ai un:
Call Shell(Environ$("COMSPEC") & " /c @echo o | format a: /q",
vbHide) OU
Call Shell("format_a.bat", vbHide)
PUIS
copies de fichier de c sur a...
Le problème, c'est shell étant une fonction asynchrone, le
formatage n'a pas le temps de se faire, il est annulé par la suite de
la copie, alors à part mette un timer, où une validation MsgBox de
formatage, que voyez-vous comme solution ???
Nb, hier ça marchait, mais j'ai remanié mon code, et ça coince, voici:
Dim ordre As String
Dim source As String
Dim cible As String
'
Screen.MousePointer = vbHourglass
ordre = "@echo o | format a:/q"
pf13 = FreeFile
Open "format_a.bat" For Output As pf13
Print #pf13, ordre
Close pf13
'
'Call Shell(Environ$("COMSPEC") & " /c @echo o | format a: /q",
vbHide) Call Shell("format_a.bat", vbHide)
'
On Error GoTo erreur
source = App.Path & "Noms_C.txt"
cible = "a:Noms_C.txt"
FileCopy source, cible
source = App.Path & "Libel_C.txt"
cible = "a:Libel_C.txt"
FileCopy source, cible
'
For i = 0 To List2.ListCount - 1
source = App.Path & "" & List2.List(i) & "_C.txt"
cible = "a:" & List2.List(i) & "_C.txt"
FileCopy source, cible
Next i
Private Declare Function OpenProcess Lib "kernel32" _ (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, _ ByVal dwProcessId As Long) As Long Private Declare Function WaitForSingleObject Lib "kernel32" _ (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long Const SYNCHRONIZE = &H100000 Const INFINITE = &HFFFF
Call sauvegarde
Function ShellAndWait() As Boolean ' sauvegarde Dim idProc As Long Dim hProc As Long Dim iRet As Long Dim hNull As Long ' idProc = Shell(Environ$("COMSPEC") & " /c @echo o | format a: /q", vbHide) hProc = OpenProcess(SYNCHRONIZE, False, idProc) If hProc <> hNull Then iRet = WaitForSingleObject(hProc, INFINITE) CloseHandle hProc ShellAndWait = True End If If hProc = hNull Then ShellAndWait = False DoEvents End Function -----------
"ng" a écrit dans le message de news:
Salut,
Hop, une petite recherche qqes jours en arrière et on trouve : http://groups.google.fr/groups?q=ShellAndWait+author:ng&hl=fr&lr=&selm=OAMNRBa6EHA.796%40TK2MSFTNGP09.phx.gbl&rnum=1
-- Nicolas G. FAQ VB : http://faq.vb.free.fr API Guide : http://www.allapi.net Google Groups : http://groups.google.fr/ MZ-Tools : http://www.mztools.com/
LE TROLL wrote:
Bonjour,
J'ai un:
Call Shell(Environ$("COMSPEC") & " /c @echo o | format a: /q", vbHide) OU Call Shell("format_a.bat", vbHide) PUIS copies de fichier de c sur a...
Le problème, c'est shell étant une fonction asynchrone, le formatage n'a pas le temps de se faire, il est annulé par la suite de la copie, alors à part mette un timer, où une validation MsgBox de formatage, que voyez-vous comme solution ???
Nb, hier ça marchait, mais j'ai remanié mon code, et ça coince, voici:
Dim ordre As String Dim source As String Dim cible As String ' Screen.MousePointer = vbHourglass ordre = "@echo o | format a:/q" pf13 = FreeFile Open "format_a.bat" For Output As pf13 Print #pf13, ordre Close pf13 ' 'Call Shell(Environ$("COMSPEC") & " /c @echo o | format a: /q", vbHide) Call Shell("format_a.bat", vbHide) ' On Error GoTo erreur source = App.Path & "Noms_C.txt" cible = "a:Noms_C.txt" FileCopy source, cible source = App.Path & "Libel_C.txt" cible = "a:Libel_C.txt" FileCopy source, cible ' For i = 0 To List2.ListCount - 1 source = App.Path & "" & List2.List(i) & "_C.txt" cible = "a:" & List2.List(i) & "_C.txt" FileCopy source, cible Next i