Name

BeginReplay

Description

HRESULT
BeginReplay(ISnapshot* recording,
            LONG options,
            IVixHandle* propertyList,
            ICallback* jobDoneCallback,
            IJob** pauseJob);

This function replays a recording of a virtual machine.

Parameters

recording
snapshot object that represents the recording.
options
Must be VIX_VMPOWEROP_NORMAL or VIX_VMPOWEROP_LAUNCH_GUI.

propertyListHandle
Must be NULL (C++), null (C#), or Nothing (VB).
jobDoneCallback
An ICallback instance that will be called when the operation is complete.
replayJob
Returns an IJob object that describes the state of this asynchronous operation.

Return Value

HRESULT

Remarks

Side Effects

None.

Requirements

VixCOM.h, since VMware Workstation 6.5

Example


The following example shows how to record the execution of a virtual machine while a program is running, then stop the recording once the program exits, and then replay that recording.

VBScript:

' Start the recording
Set job = vm.BeginRecording("Recording of testApp", "Testing a new feature", _
                            0, Nothing, Nothing)
err = job.Wait(Array(VixCOM.Constants.VIX_PROPERTY_JOB_RESULT_HANDLE), results)
If lib.ErrorIndicatesFailure(err) Then
   ' Handle the error...
End If

recording = results(0)

' Run the program
Set job = vm.RunProgramInGuest("C:\testApp.exe", "", 0, Nothing, Nothing)
err = job.WaitWithoutResults()
If lib.ErrorIndicatesFailure(err) Then
   ' Handle the error...
End If

' By default, RunProgramInGuest waits until the program has finished running.

' Stop the recording.
Set job = vm.EndRecording(0, Nothing, Nothing)
err = job.WaitWithoutResults()
If lib.ErrorIndicatesFailure(err) Then
   ' Handle the error...
End If

' Power off the virtual machine before replaying the recording.
Set job = vm.PowerOff(0, Nothing)
err = job.WaitWithoutResults()
If lib.ErrorIndicatesFailure(err) Then
   ' Handle the error...
End If

Set job = vm.BeginReplay(recording, 0, Nothing, Nothing)
err = job.WaitWithoutResults()
If lib.ErrorIndicatesFailure(err) Then
   ' Handle the error...
End If

Set results = Nothing
Set job = Nothing

Copyright (C) 2007-2010 VMware, Inc. All rights reserved.