Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problems with API_APPRUN
Message
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00529409
Message ID:
00529426
Views:
16
>I am using the API_APPRUN class in my program, and am having a problem with it. On 2000 machines, it works without a hitch. On every single 98 machine we've tested it on, it hangs when I run this code:
>
>ThisForm.RunApp.icCommandLine="PKZ -3 -- -+ -) -O MOD.ZIP _MDCPT.DBF"
>ThisForm.RunApp.LaunchAppAndWait()
>
>I've got around 20 pieces of code like this (each one unzipping a specific file from mod.zip), and on every "ThisForm.RunApp.LaunchAppAndWait()", it hangs until I hit Escape (that's programmed into the VCX).
>
>Has anyone else had this problem with API_APPRUN and 98 machines? Am I missing something? I tried to contact the author, but to no avail.
>
>This is the code that is in LaunchAppAndWait():
>
>#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
> =WaitInpIdle(GetCurrProc(),cnINFINITE)
> * 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)
>
>It's hanging inside that DO WHILE loop. Any API Guru's out there know why this happens? Thanks!

Does the desired command work when run manually from a DOS box under W98? The reason why I ask is that the NT/W2K CMD.EXE command processor interprets some PKZIP parameters differently from W9x.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform