Name
Wait
Description
HRESULT
Wait([in] VARIANT propertyIDs,
[in,out] VARIANT* propertiesArray,
[out,retval] ULONGLONG* error);
Wait for a particular job to complete.
Parameters
- propertyIDs
-
An array of propertyIDs to identify the properties
to fetch.
- propertiesArray
-
An returned array that stores the properties
identified by the array "propertyIDs". Each
element in "propertiesArray" matches the
correspoding indentifier in "propertiesArray";
for example, if the first element in the "propertyIDs" array
is VixCOM.Constants.VIX_PROPERTY_JOB_RESULT_HANDLE,
the first element in "propertiesArray" will be the
object that is the result of this job, if one exists.
- error
-
The error resulting from the asynchronous operation that returned
the IJob object.
Return Value
HRESULT
Remarks
- This function blocks until the job completes.
- The error code returned by this function is the same as the error code
returned by
Job::GetError().
- The error code returned by this function is also available in the
VixCOM.Constants.VIX_JOB_RESULT_ERROR_CODE
property of the job object.
- Do not use
Wait()
to complete a job for which you have passed a
ICallback object.
The completion order in such a situation is undefined,
and you cannot rely on the resulting property values.
Side Effects
None.
Requirements
VixCOM.h, since VMware Workstation 6.0.
Example
VBScript:
Dim lib
Dim host
Dim job
Dim vm
Dim result
Set lib = CreateObject("VixCOM.VixLib")
Set job = lib.Connect(VixCOM.Constants.VIX_API_VERSION, VixCOM.Constants.VIX_SERVICEPROVIDER_VMWARE_WORKSTATION, Empty, 0, Empty, Empty, 0, Nothing, Nothing)
' results needs to be initialized before it's used, even if it's just going to be overwritten.
Set results = Nothing
err = job.Wait(Array(VixCOM.Constants.VIX_PROPERTY_JOB_RESULT_HANDLE), results)
If lib.ErrorIndicatesFailure(err) Then
' Handle the error...
End If
Set host = results(0)
Set job = host.OpenVM("c:\Virtual Machines\vm1\win2000.vmx", Nothing)
err = job.Wait(Array(VixCOM.Constants.VIX_PROPERTY_JOB_RESULT_HANDLE), results)
If lib.ErrorIndicatesFailure(err) Then
' Handle the error...
End If
Set vm = results(0)
host.Disconnect()