Soyez le premier à donner votre avis sur cette source.
Vue 11 483 fois - Téléchargée 1 043 fois
'Dans Un Module Public Declare Function ShellExecuteA Lib "shell32" (ByVal hwnd As Long, ByVal LPFile As String, ByVal PathFile As String, ByVal Other As String, ByVal Other2 As String, ByVal Param As Long) As Long 'Dans Votre Form Option Explicit Dim Tot As String Private Sub Command1_Click() Dim RetVal RetVal = ShellExecuteA(0, "Open", Dir1.Path & "\" & File1.FileName, "", "", 10) End Sub Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Label1.ForeColor = &H0& End Sub Private Sub Label1_Click() Label1.ForeColor = &HFF& Shell ("c:\Program Files\Internet Explorer\IEXPLORE.EXE http://perso.wanadoo.fr/crazydoub") End Sub Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Label1.ForeColor = &HFF& End Sub Private Sub Timer1_Timer() If Len(Dir1.Path) < 5 Then Tot = Dir1.Path & File1.FileName If Len(Dir1.Path) > 5 Then Tot = Dir1.Path & "\" & File1.FileName Text1.Text = Tot Dir1.Path = Drive1.Drive File1.Path = Dir1.Path Text2.Text = Len(Dir1.Path) DirPathShell.Caption = Tot & " - " & "Cliquez Sur Executer" End Sub
le code est là, autant le mettre "au gout du jour" et indiquer ce qui va ou pas.
on a tous des vieux codes dont on prefere ne pas parler ^^
Le code date de 20003, c'est mon premier programme....
Arrêtez de déterrer!
Je rejoint SeeNapse, trop de code inutile, utilisation d'un Timer inutile, etc.
Allez, un peu de ménage :
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 Const SW_NORMAL As Long = 1
Private Sub Drive1_Change()
On Local Error GoTo Handler
Dir$ Drive1.Drive
Dir1.Path = Drive1.Drive
Exit Sub
Handler:
If Err.Number = 52 Then
MsgBox "Le lecteur " & Drive1.Drive & " n'est pas accessible.", vbExclamation, "Lecteur non prêt."
Drive1.Drive = Left$(Dir1.Path, 2)
Else
MsgBox Err.Description, , "Error " & Err.Number
End If
End Sub
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
Private Sub File1_Click()
If File1.ListIndex <> -1 Then
Text1.Text = File1.FileName
Text2.Text = Len(File1.FileName)
End If
End Sub
Private Sub File1_DblClick()
OuvrirFichierSelectionne
End Sub
Private Sub Command1_Click()
OuvrirFichierSelectionne
End Sub
Private Sub OuvrirFichierSelectionne()
If File1.ListIndex <> -1 Then
ShellExecute 0, "Open", File1.FileName, vbNullString, Dir1.Path, SW_NORMAL
End If
End Sub
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.