'Déclaration de l'api Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long Const SW_SHOWNORMAL = 1 Private Sub Form_Load() Dim Ret As Byte 'Variable pour verification de l'aboutissement du shell 'Lancement du fichier .msc Ret = ShellExecute(Me.hwnd, "Open", "perfmon.msc", vbNullString, "C:", SW_SHOWNORMAL) 'en cas d'erreur ShellExecute renvoie un chiffre inferieur a 33 If Ret < 33 Then MsgBox "Impossible d'ouvrir ce fichier..." End Sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionPrivate Sub Form_Load() Dim Ret As Long, Chemin As String, Fichier As String Chemin = "c:\winnt\system32" Fichier = Chemin & "dhcpmgmt.msc Ret = ShellExecute(Me.hwnd, "Open", Fichier, vbNullString, Chemin,SW_SHOWNORMAL) If Ret < 33 Then MsgBox "Impossible d'ouvrir ce fichier..." End Sub