Soyez le premier à donner votre avis sur cette source.
Vue 30 796 fois - Téléchargée 2 198 fois
Public Function ExecCmd(ByRef vsCmdLine As String, Optional ByRef vsParameters As String, Optional ByRef vsCurrentDirectory As String = vbNullString, Optional ByVal vnShowCmd As Long = SW_SHOW, Optional ByVal vnTimeOut As Long = 200) As Long Dim lpShellExInfo As SHELLEXECUTEINFOA With lpShellExInfo .cbSize = Len(lpShellExInfo) .lpDirectory = vsCurrentDirectory .lpVerb = "open" .lpFile = vsCmdLine .lpParameters = vsParameters .nShow = vnShowCmd .fMask = SEE_MASK_DOENVSUBST Or SEE_MASK_NOCLOSEPROCESS Or SEE_MASK_IDLIST End With If ShellExecuteEx(lpShellExInfo) Then Do While WaitForSingleObject(lpShellExInfo.hProcess, vnTimeOut) = WAIT_TIMEOUT DoEvents Loop GetExitCodeProcess lpShellExInfo.hProcess, ExecCmd CloseHandle lpShellExInfo.hProcess Else ExecCmd = vbError End If End Function 'et les déclarations : Public Const SEE_MASK_DOENVSUBST As Long = &H200 Public Const SEE_MASK_IDLIST As Long = &H4 Public Const SEE_MASK_NOCLOSEPROCESS As Long = &H40 Public Const SW_HIDE As Long = 0 Public Const SW_SHOW As Long = 5 Public Const WAIT_TIMEOUT As Long = 258& Public Type SHELLEXECUTEINFOA cbSize As Long fMask As Long hwnd As Long lpVerb As String lpFile As String lpParameters As String lpDirectory As String nShow As Long hInstApp As Long lpIDList As Long lpClass As String hkeyClass As Long dwHotKey As Long hIcon As Long hProcess As Long End Type Public Declare Function CloseHandle Lib "kernel32.dll" (ByVal hObject As Long) As Long Public Declare Function GetExitCodeProcess Lib "kernel32.dll" (ByVal hProcess As Long, ByRef lpExitCode As Long) As Long Public Declare Function ShellExecuteEx Lib "shell32.dll" (ByRef lpExecInfo As SHELLEXECUTEINFOA) As Long Public Declare Function WaitForSingleObject Lib "kernel32.dll" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
17 nov. 2009 à 15:34
rien à redire, fonctionne du premier coup
10 mars 2009 à 14:13
Merci Renfield !
25 juil. 2007 à 10:23
Merci.
25 juin 2007 à 10:03
if ExecCmd ("c:\monapplication.exe", "-x -y") = 0 then
24 juin 2007 à 16:17
Vous n'êtes pas encore membre ?
inscrivez-vous, c'est gratuit et ça prend moins d'une minute !
Les membres obtiennent plus de réponses que les utilisateurs anonymes.
Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.
Le fait d'être membre vous permet d'avoir des options supplémentaires.