主题:文件列表框双击不执行文件怎么修改?
sjvfhp
[专家分:0] 发布于 2008-08-17 17:28:00
双击VB文件列表框中的文件能否直接运行该文件? 我把原文件上传到了,merry05 已经给我解答过了,可我是新手还是不会编。希望各位大侠能帮助我给出VB代码。非常感谢大家。我的邮箱是:sjvfhp@163.com(注:我已经把四个文件都上传了)
最后更新于:2008-08-18 10:40:00
回复列表 (共3个回复)
沙发
一江秋水 [专家分:9680] 发布于 2008-08-18 09:17:00
你要把窗体文件一起传上来,光传个工程文件有何用?
板凳
joforn [专家分:1460] 发布于 2008-08-20 16:44:00
还是少个文件。
3 楼
tjestar [专家分:3520] 发布于 2008-08-21 13:54:00
'用下面的这段代码,连".LNK"都能给你运行!
Public 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 Type SHELLEXECUTEINFO
cbSize As Long
fMask As Long
hwnd As Long
lpVerb As String
lpFile As String
lpParameters As String
lpDirectory As String
nShow As Long
hInstApp As Long
lpIDList As Long
lpClass As String
hkeyClass As Long
dwHotKey As Long
hIcon As Long
hProcess As Long
End Type
Const SEE_MASK_INVOKEIDLIST = &HC
Const SEE_MASK_NOCLOSEPROCESS = &H40
Const SEE_MASK_FLAG_NO_UI = &H400
Public Function ShowProps(FileName As String, OwnerhWnd As Long) As Long
Dim SEI As SHELLEXECUTEINFO
Dim R As Long
With SEI
'Set the structure's size
.cbSize = Len(SEI)
'Seet the mask
.fMask = SEE_MASK_NOCLOSEPROCESS
'Set the owner window
.hwnd = OwnerhWnd
'Show the properties
.lpVerb = "open"
'Set the filename
.lpFile = FileName
.lpParameters = vbNullChar
.lpDirectory = vbNullChar
.nShow = 3
.hInstApp = 0
.lpIDList = 0
End With
R = ShellExecuteEx(SEI)
If R Then
ShowProps = SEI.hProcess
End If
End Function
我来回复