j'utilise la méthode ShellWait de Raymond (merci pour ton site) pour lancer
une ligne de commande mais je ne trouve pas comment faire pour utiliser les
paramètres windowstyle comme vbHide ou vbMinimizedNoFocus ?
Merci d'avance de votre aide,
Casa
Ci-dessous code de raymond :
http://officesystem.access.free.fr/apishellwait.htm
Option Compare Database
Option Explicit
Private Const Priorité_Normale = &H20&
Private Const Infini = -1&
Dim Name_Process As Info_Process
Dim Name_Initial As Info_Initiale
Dim ProcessOK As Long
Private Declare Function AppFermer Lib "kernel32" Alias "CloseHandle" _
(hObject As Long) As Boolean
Private Declare Function AppExecuter Lib "kernel32" Alias
"WaitForSingleObject" _
(ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
Private Declare Function AppProcess Lib "kernel32" Alias "CreateProcessA" _
(ByVal lpApplicationName As Long, ByVal lpCommandLine As String, _
ByVal lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, _
ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, _
ByVal lpEnvironment As Long, ByVal lpCurrentDirectory As Long, _
lpInfo_Initiale As Info_Initiale, _
lpProcessInformation As Info_Process) As Long
Private Type Info_Initiale
cb As Long
lpReserved As String
lpDesktop As String
lpTitle As String
dwX As Long
dwY As Long
dwXSize As Long
dwYSize As Long
dwXCountChars As Long
dwYCountChars As Long
dwFillAttribute As Long
dwFlags As Long
wShowWindow As Integer
cbReserved2 As Integer
lpReserved2 As Long
hStdInput As Long
hStdOutput As Long
hStdError As Long
End Type
Private Type Info_Process
hProcess As Long
hThread As Long
dwProcessId As Long
dwThreadID As Long
End Type
Private Function ShellWait(AppName As String) As Boolean
Name_Initial.cb = Len(Name_Initial)
ProcessOK = AppProcess(0&, AppName, 0&, 0&, 1&, _
Priorité_Normale, 0&, 0&, Name_Initial, Name_Process)
If ProcessOK <> 0 Then
Call AppExecuter(Name_Process.hProcess, Infini)
Call AppFermer(Name_Process.hProcess)
ShellWait = True
Else
ShellWait = False
End If
End Function
--