HRESULT
BeginReplay(ISnapshot* recording,
LONG options,
IVixHandle* propertyList,
ICallback* jobDoneCallback,
IJob** pauseJob);
This function replays a recording of a virtual machine.
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