ahc水乳跟兰芝哪个好用:vb中怎么实现双击执行当前文件

来源:百度文库 编辑:神马品牌网 时间:2024/05/02 04:39:15
在文件的list框中
shell(file1.filename)是不行的,求教

Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub

Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
End Sub

Private Sub File1_DblClick()
Shell "cmd.exe /c " + IIf(Right$(Dir1.Path, 1) = "\", Dir1.Path, Dir1.Path + "\") + File1.FileName, vbHide
'注意:cmd.exe /c 后面还有个空格
End Sub

shell函数是用来执行一个可执行文件,如果你还想执行其他文件就用上面的代码