Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calling a program not working
Message
 
To
07/01/2014 12:29:02
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01591457
Message ID:
01594560
Views:
45
Thanks Tore, works perfectly.
~M

>>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)
>
>*ShellX.prg
>Lparameters tcURL, tcParameter
>if empty(tcParameter)
>   tcParameter = ''
>Endif
>
>#define SW_HIDE 0
>#DEFINE SW_SHOWNORMAL 1
>#DEFINE SW_SHOWMINIMIZED 2
>#DEFINE SW_SHOWMAXIMIZED 3
>
>*!*   Legal verbs: open, edit, print, find, explore, NULL
>
>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 )
Go raibh maith agat

~M
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform