Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problems with API_APPRUN
Message
From
12/07/2001 12:43:00
 
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00529409
Message ID:
00529810
Views:
8
I've seen the same problem on Win2000 with +800MHz cpus, below is my fix.
>#DEFINE cnINFINITE 		0xFFFFFFFF
>#DEFINE cnHalfASecond	500	&& milliseconds
>#DEFINE cnTimedOut		258	&& 0x0102
>*	We need some API calls, declare here
>*	GetCurrentProcess returns the pseudohandle of the current process (ie VFP instance)
>DECLARE INTEGER GetCurrentProcess IN WIN32API AS GetCurrProc
>*	WaitForIdleInput waits until the application is instantiated and at it's event loop
>DECLARE INTEGER WaitForInputIdle IN WIN32API AS WaitInpIdle ;
>	INTEGER nProcessHandle, ;
>	INTEGER nWaitForDuration
>*	WaitForSingleObject waits until the handle in parm 1 is signalled or the timeout period expires
>DECLARE INTEGER WaitForSingleObject IN WIN32API AS WaitOnAppExit ;
>	INTEGER hProcessHandle, ;
>	INTEGER dwTimeOut
>*	Save the Process handle if any and the result of LaunchApp
>*	Fire the app and save the process handle
>LOCAL uResult
>uResult = 0
>WITH This
>	.icErrorMessage = ''
>	IF .LaunchApp()
>		uResult = 1
>		*	It's been launched;  wait until we're idling along
************************************************
*** Old stuff
************************************************
>		*** =WaitInpIdle(GetCurrProc(),cnINFINITE)
************************************************
*** New stuff
************************************************
		=WaitInpIdle(GetCurrProc(),1000)
************************************************
*** End of changes
************************************************
>		*	As long as the other process exists, wait for it
>		DO WHILE WaitOnAppExit(.inProcessHandle, cnHalfASecond) = cnTimedOut
>			*	Give us an out in case the other app hangs - let
>			IF INKEY() = 27
>				*	Still running but we aren't waiting - return a -1 as a warning
>				.icErrorMessage = 'Process started but user did not wait on termination'
>				uResult = 0
>				EXIT
>			ENDIF
>		ENDDO
>	ELSE
>		*	Return 0 to indicate failure
>		uResult = 0
>	ENDIF
>ENDWITH
>RETURN (uResult = 1)
Previous
Reply
Map
View

Click here to load this message in the networking platform