WaitProcess Method

PocketBrowser 3.x API

The WaitProcess Method of the Generic ActiveX Object waits for the process started by LaunchProcessNonBlocking to terminate or time out.



WaitProcess (Method of the Generic ActiveX Object) Syntax
var bRetVal = objGeneric.WaitProcess(hProcessHandle, TimeoutValue);

ParametersW Toggle Parameters

Items listed in this section indicate parameters, or attributes which can be set.

Name Possible Values Description
Default Value
hProcessHandle Handle Handle returned by LaunchProcessNonBlocking N/A
TimeoutValue Seconds Time to wait before method times out. A value of 0 will return immediately and can be used to determine if the process has completed or not. N/A

axReturns Toggle Return Values

Name Description
bRetVal True if the process terminated or False if the timeout expired.

Examples Toggle Examples

The following javascript example launches CtlPanel and waits for it to quit for 5 seconds. An alert is given depending on whether the process was stopped or not.

<script>
var objGeneric = new ActiveXObject("PocketBrowser.Generic");
var hProcess = objGeneric.LaunchProcessNonBlocking('\\application\\ctlpanel.exe', '');
//  Give the user 5 seconds to quit the process
var bRetVal = objGeneric.WaitProcess(hProcess, 5);
if (bRetVal)
alert('Process Ended by User');
else
alert('Process Still Running');
objGeneric.CloseProcess(hProcess);
</script>
Copy example to clipboard Copy example to clipboard

Info Toggle Additional Information

Supported Platforms Windows CE, Windows Mobile
Persistence Runs instantly.
Min. Requirements None.