ticrain
Messages postés178Date d'inscriptionjeudi 15 mars 2007StatutMembreDernière intervention 2 janvier 2015
-
26 avril 2007 à 11:52
drikce06
Messages postés2237Date d'inscriptionlundi 29 mai 2006StatutMembreDernière intervention29 mai 2008
-
26 avril 2007 à 17:15
Bonjour à tous voila sa fait un petit moment que je cherche pour ouvrir un programme quelconque avec la commande shellexecute.
G plusieurs fichier word et excel sur le C:. C 'est fichier apparaissent dans une listbox donc je peut avoir soi des fichier .doc ou excel, j'aimerai que mon prog puisse s'executer avec la bonne application en focntion de se que j'a choisi dans la listbox 1 voila se que j'ai commencé à faire:
Option Explicit
Private Declare Function ShellExecute Lib "shell32.dll" (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
Private Const SW_MAXIMIZE = 3
Private Sub CommandButton2_Click()
Dim nomdoc As String
Dim chemindoc As String
nomdoc = ListBox1.List(ListBox1.ListIndex)
chemindoc = "c:\&nomdoc"
Call ShellExecute(0, "open", nomdoc, vbNullString, vbNullString, SW_MAXIMIZE)
End Sub
il ne se passe rien il n'ouvre rien j'ai du oublier des truc
drikce06
Messages postés2237Date d'inscriptionlundi 29 mai 2006StatutMembreDernière intervention29 mai 200811 26 avril 2007 à 11:54
Salut, en .Net les types long sont à changer en integer!
Sinon va sur www.codyx.org et tu trouveras un snippet pour faire ça à la façon .Net (startprocess)
Drikce 06
Si la réponse vous convient: Réponse acceptée. Si la réponse vous convient pas:
ticrain
Messages postés178Date d'inscriptionjeudi 15 mars 2007StatutMembreDernière intervention 2 janvier 2015 26 avril 2007 à 14:51
il n'est pas d'accord il me marque erreur de compilation pour le (ME.hwnd
voici ce que g maintenant:
Option Explicit
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
Private Sub CommandButton2_Click()
Dim nomdoc As String
nomdoc = ListBox1.List(ListBox1.ListIndex)
Dim chemindoc As String
chemindoc = "c:" & nomdoc
Call ShellExecute(Me.hwnd, "open", nomdoc, vbNullString, vbNullString, SW_MAXIMIZE)
End Sub