Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using shellexecute in .prg file.. Shell Execute Can't Fi
Message
 
 
To
23/10/2004 21:26:44
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 6 SP3
Miscellaneous
Thread ID:
00954044
Message ID:
00954109
Views:
21
Jack,

ShellExecute() can not provide modal execution. If the WindowsScripting Host is available the code below will work.

>Running into a problem that I cannot find a solution for. In order to run a particular executable from a .prg file over a network without mapping a drive letter (using a UNC path), I need to run the program file from shellexecute. No problem there. The problem comes from the fact the Visual FoxPro wants to just keep going before the program shellexecute started finishes. I need a way to allow the program (pkzip) to complete without the user having to hit a key (required with the wait command.)
>
>Question... Is there a way to allow the shellexecute command to finish before the .prg file continues? Without having to use WAIT?
function RunProcess( pcProgram, pcArguments, pnShowWindow, plModal )

* RunProcess.prg 24-Aug-99 DGF

* Usage: RunProcess( "notepad", "testdocument.txt", SW_SHOWNORMAL, .T. )

local loShell, lnRetVal

if type('pcArguments') != 'C'
	pcArguments = ""
endif

loShell = createobject( "wscript.shell" )
lnRetVal = loShell.Run( pcProgram + " " + pcArguments, pnShowWindow, plModal )
return lnRetVal
If you can't use the WSH, look for a FAQ here written by Ed Rauh that gives another API call you can make.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Reply
Map
View

Click here to load this message in the networking platform