>Hi all,
>I have an unusual one. I am trying to call an exe called iviewer in a folder c:\program files\folder1 and pass in some parameters. I am trying to get this working using a prg and the run command, with no joy. I've also tries it via an exe, again with no joy. These are run from the e drive but will ultimately be run from a mapped drive. The exe I am calling is an installed program and not a VFP one.
>If I put the prg or exe in the c:\program files\folder1 folder it will work. On the user security I have given my user full rights to the folder.
>When I run it the dos box flashes up but the program is not called. I know this as I have message boxes in it, I can see them if I call it from the c:\program files\folder1 folder but not if called externally.
>Any ideas?
>~M
The Run command is normally a bad idea, since there's no way to avoid the black DOS window from flashing! Also passing parameters can be problematic. Use ShellExecute API call instead. This function ShellX is a wrapper around the API call.
lcProg = 'c:\program files\folder1\myProg.exe'
lcPar = 'some parameters'
ShellX(lcProg, lcPar)
Lparameters tcURL, tcParameter
if empty(tcParameter)
tcParameter = ''
Endif
#define SW_HIDE 0
#DEFINE SW_SHOWNORMAL 1
#DEFINE SW_SHOWMINIMIZED 2
#DEFINE SW_SHOWMAXIMIZED 3
DECLARE INTEGER ShellExecute IN shell32.dll ;
INTEGER hndWin, STRING cAction, STRING cFileName, ;
STRING cParams, STRING cDir, INTEGER nShowWin
ShellExecute( 0, "open", tcURL, tcParameter , "", SW_SHOWNORMAL )