注册 登录
编程论坛 VB6论坛

VB调用Fortran生成的exe文件有问题

西瓜冰沙 发布于 2019-10-31 13:18, 1669 次点击
用VB调用Fortran生成的exe文件,文件夹和路径都没有问题,exe直接双击可以打开,但是调用的时候闪一下就没了,各位大佬,这是怎么回事附上我的代码
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

Private Sub Command1_Click()
ShellExecute Me.hWnd, "open", App.Path & "\wafdut14\WAFDUT14.exe", "-console", "", 1
End Sub


拜托拜托
1 回复
#2
风吹过b2019-10-31 13:43
很可能是一个 相对路径的问题。
这个EXE,如果是使用读程序目录下的设置文件时,如像上面这个代码使用的 app.path ,因为不是在当前目录下执行,导致找不到配置文件什么的,程序自己退出。

ShellExecute Me.hWnd, "open", App.Path & "\wafdut14\WAFDUT14.exe", "-console", App.Path & "\wafdut14\" , 1

1