I'm working on a VB menu app, trying to launch a SQLWINDOWS app that resides on a network.
I need to specify the default directory (working directory) for the started application. I'm wondering if I need something like an API call, such as CreateProcess. SHELL doesn't seem to have a parameter for this.
Here's the problem:
The menu launches the SQLWINDOWS app with this command:
ld_RetCd = Shell(ls_AppPath & ls_AppId & ".exe" & " " & ls_AppCmdLine, vbNormalFocus)
ls_AppPath is a UNC path and ls_AppId is the name of the executable file.
This commands appears to find the application in the correct directory (ls_AppPath), and try to run it. It fails because the started app cannot find SQLRUN50.EXE that it needs to run. SQLRUN.EXE is located in the same directory as the started application (in ls_AppPath).
I think the started app inherits the current working directory (which I don't want!). I've tried a CHDIR ls_AppPath immediately before the Shell command, but that does not correct the problem.
The application was originally using relative paths for the CHDIR and SHELL commands, but only worked occasionally. It usually failed on the CHDIR command, although the relative path was correct. We switched to UNC path names, which got us past the CHDIR to the SHELL command.
Any ideas?
Thanks!!
I need to specify the default directory (working directory) for the started application. I'm wondering if I need something like an API call, such as CreateProcess. SHELL doesn't seem to have a parameter for this.
Here's the problem:
The menu launches the SQLWINDOWS app with this command:
ld_RetCd = Shell(ls_AppPath & ls_AppId & ".exe" & " " & ls_AppCmdLine, vbNormalFocus)
ls_AppPath is a UNC path and ls_AppId is the name of the executable file.
This commands appears to find the application in the correct directory (ls_AppPath), and try to run it. It fails because the started app cannot find SQLRUN50.EXE that it needs to run. SQLRUN.EXE is located in the same directory as the started application (in ls_AppPath).
I think the started app inherits the current working directory (which I don't want!). I've tried a CHDIR ls_AppPath immediately before the Shell command, but that does not correct the problem.
The application was originally using relative paths for the CHDIR and SHELL commands, but only worked occasionally. It usually failed on the CHDIR command, although the relative path was correct. We switched to UNC path names, which got us past the CHDIR to the SHELL command.
Any ideas?
Thanks!!