Name

BeginRecording

Description

HRESULT
BeginRecording(BSTR name,
               BSTR description,
               LONG options,
               IVixHandle* propertyList,
               ICallback* jobDoneCallback,
               IJob** recordingJob);

This function records a virtual machine's activity as a snapshot object. The snapshot object is returned in the job object's properties.

Parameters

name
A user-defined name for the recording; need not be unique.
description
A user-defined description for the recording.
options
Must be zero.
propertyListHandle
Must be NULL (C++), null (C#), or Nothing (VB).
jobDoneCallback
An ICallback instance that will be called when the operation is complete.
recordingJob
Returns an IJob object that describes the state of this asynchronous operation.

Return Value

HRESULT

Remarks

Side Effects

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.