旧的问题刚刚解决,又出现新的问题,呼湫呼湫~~
要求:
在我编的程序里执行另外一个exe文件(为方便叙述,文件名为problem.exe),并测出problem.exe的运行时间。
说明:
该exe文件是用Tubro C或Pascal环境编译生成的。
双击problem.exe图标,会读入problem.in文件(已经有了),生成problem.out文件。
我已经尝试的方法:
1、[Shell]
执行:shell "c:\problem.exe",vbHide
结果:显示执行时间为10ms左右
***但是*** c:\ 并没有生成problem.out(这个输出文件对我以后的工程很重要)
2、[ShellExecute]
定义: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
Const SW_SHOWNORMAL = 1
执行:ShellExecute Me.hwnd, vbNullString, "problem.exe", vbNullString, "c:\", SW_SHOWNORMAL
结果:显示执行时间为30ms左右
***但是*** c:\ 并没有生成problem.out
3、[WinExec]
定义:Private Declare Function WinExec Lib "kernel32" (ByVal lpCmdLine As String, ByVal nCmdShow As Long) As Long
Const SW_SHOWNORMAL = 1
执行:WinExec "c:\problem.exe", SW_SHOWNORMAL
结果:显示执行时间为10ms左右
***但是*** c:\ 并没有生成problem.out
4、[shell]-调用命令行
执行:Shell "command.com /c c:\problem.exe", vbHide
结果:显示执行时间为20ms左右
***但是*** c:\ 并没有生成problem.out
请问,
一、究竟怎么样才能使得效果完全像双击图标呢?(即一定要生成problem.out文件)
二、怎么样保证侧的时间为problem.exe完整执行完的时间?