VB:我想把加载到listview中的文件(已经实现),然后选中双击打开它(选中文件名)

来源:百度知道 编辑:UC知道 时间:2024/05/13 15:12:44

ListView1.SelectedItem 返回你当前选中的对象
有了这个对象,你再结合路径,就可以打开了
用ShellExecute这个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


ShellExecute Me.hWnd, "open", "路径\" & ListView1.SelectedItem , "", "", 0