DraaFil
Messages postés264Date d'inscriptionmercredi 16 avril 2003StatutMembreDernière intervention23 mars 2012
-
5 sept. 2007 à 00:19
cs_Chatbour
Messages postés764Date d'inscriptionjeudi 27 juillet 2006StatutMembreDernière intervention 6 septembre 2010
-
5 sept. 2007 à 01:22
Bonjour à tous,
J'ai trouver un code sur le site (je ne sais pu de qui) et il excute bien mon fichier, mais j'aurais besoin de lui passer un parametre (ex: allo.exe /S).
Est-ce que quelqu'un pourrais me dire comment faire pour que cela fonctionne correctement. Merci!
code:
Form :
Private Sub Form_Load()
ExecCmd App.Path & "\Wallpapers.exe /s" Marche pas
MsgBox "Programme fermé"
End
End Sub
Module :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