Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Questions on the RUN or ! command.
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00631537
Message ID:
00631576
Vues:
16
>>1. The screen flashes with a dos window then starts the installation.
>You're probably doing:
>! setup.exe
>instead of ! /n setup.exe
>the /n says it's a windows program, no need to open a dos box.
>
>>2. My launching program continues to the next command even though the
>> installation of adobe reader is not finished.
>that's becuase it's a windows program, look in the files section for "run and wait" and variations. there's at least 3 downloads for waiting for a windows program to finish executing.

LaunchAppandWait in a FAQ or APP_APIRUN by Ed Rauh in Downloads.

Here is prg by Hilmar:
********************************************************************
*  Description.......: RunDoc - opens any document
*  Calling Samples...: 
*  Parameter List....: tcDocument
*  Created by........: Hilmar Zonneveld November 8, 2001 10:43
*  Modified by.......: 
********************************************************************
* Sample use:
* MyFile = "MySpreadsheet.xls"
* RunDoc(MyFile)

FUNCTION RunDoc(tcDocument)
    if vartype(m.tcDocument)<>"C" or !file(m.tcDocument)
       return .f. && Invalid parameter 
    endif   
	local lnResult

	DECLARE INTEGER ShellExecute ;
		IN SHELL32.dll ;
		INTEGER nWinHandle, ;
		STRING cOperation, ;
		STRING cFileName, ;
		STRING cParameters, ;
		STRING cDirectory, ;
		INTEGER nShowWindow

	**retreive the main VFP window handle (this handle is used by ShellExecute)

	DECLARE INTEGER FindWindow ;
		IN WIN32API ;
		STRING cNull, ;
		STRING cWinName

	lnResult=ShellExecute(FindWindow( 0, _SCREEN.caption), "Open", tcDocument, "", "c:\temp\", 1)

	**Error messages if the return value is < 32
	IF m.lnResult < 32
		DO CASE
		CASE m.lnResult=2
			Wait wind "Invalid association or URL."
		CASE m.lnResult=31
			Wait wind "No association."
		CASE m.lnResult=29
			Wait wind "Can't start application."
		CASE m.lnResult=30
			Wait wind "Application is already open."
		ENDCASE
	ENDIF
	return m.lnResult>=32
ENDFUNC
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform