Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
'WindowsAPI函数,打开进程
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
'WindowsAPI函数,关闭Handle
Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
'WindowsAPI函数,等待进程
Const SYNCHRONIZE = &H100000 '调用WindowsAPI函数所使用的常量SYNCHRONIZE
Const INFINITE = &HFFFFFFFF '调用WindowsAPI函数所使用的常量INFINITE
Public Function RunShell(PathName, Optional WindowStyle As VbAppWinStyle) As Double
Dim pId, pHnd
On Error Resume Next
pId = Shell(PathName, WindowStyle)
pHnd = OpenProcess(SYNCHRONIZE, 0, pId)
If pHnd <> 0 Then
Call WaitForSingleObject(pHnd, INFINITE)
Call CloseHandle(pHnd)
End If
RunShell = pId
End Function
List1.Clear
Open sFileName For Input As #1
Do While (Not EOF(1))
Line Input #1, strTemp
List1.AddItem strTemp
Loop
Close #1
Kill sFileName
主要代码就是上面的东西了,sfilename是文件path和name了,我是读到list里了,记错了,以为读到listview中了