Public Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Public Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Public Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As LongPrivate Sub Command1_Click()
Dim RetVal
RetVal = Shell(App.Path & "\" & "HalfDis.exe", vbMinimizedNoFocus)
Do While IsRunning(RetVal)
DoEvents
Loop
MsgBox "调用结束"
End SubPrivate Function IsRunning(ByVal ProgramID) As Boolean '传入进程标识ID Dim hProgram As Long '被检测的程序进程句柄
hProgram = OpenProcess(0, False, ProgramID)
If Not hProgram = 0 Then
IsRunning = True
Else
IsRunning = False
End If
CloseHandle hProgram
End Function
程序代码如上,所调用HalfDis.exe文件为fortran编译,其中HalfDis.exe中需要读取和保存文本文件,而vb执行时,找不到需要读取和保存文本文件的路径,
出现run-time error f6416:open<.\indata\tqpelv.tex>-file not found错误
本人研究了几天,未能解决,恳请各位高手帮忙
Public Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Public Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As LongPrivate Sub Command1_Click()
Dim RetVal
RetVal = Shell(App.Path & "\" & "HalfDis.exe", vbMinimizedNoFocus)
Do While IsRunning(RetVal)
DoEvents
Loop
MsgBox "调用结束"
End SubPrivate Function IsRunning(ByVal ProgramID) As Boolean '传入进程标识ID Dim hProgram As Long '被检测的程序进程句柄
hProgram = OpenProcess(0, False, ProgramID)
If Not hProgram = 0 Then
IsRunning = True
Else
IsRunning = False
End If
CloseHandle hProgram
End Function
程序代码如上,所调用HalfDis.exe文件为fortran编译,其中HalfDis.exe中需要读取和保存文本文件,而vb执行时,找不到需要读取和保存文本文件的路径,
出现run-time error f6416:open<.\indata\tqpelv.tex>-file not found错误
本人研究了几天,未能解决,恳请各位高手帮忙
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货