Name

VMCaptureScreenImage

Description

($err, $imageSize, $imageBytes) = VMCaptureScreenImage($vmHandle, $captureType, 
						       $propertyListHandle);

This function captures the screen of the guest operating system.

Parameters

vmHandle
The handle to the VM.
captureType
the data format. Must be VIX_CAPTURESCREENFORMAT_PNG
additionalProperties
must be VIX_INVALID_HANDLE

Return Value

$err. The error code returned by the operation. For returned values, see Topics > Error Codes.

$imageSize. The size of the image in bytes.

$imageBytes. The bytes making up the image.

Remarks

For security reasons, this function requires a successful call to VMLoginInGuest must be made.

Side Effects

None.

Requirements

use VMware::Vix::Simple;
use VMware::Vix::API::Constants;
since VMware Workstation 6.5
Minimum Supported Guest OS: Microsoft Windows NT Series, Linux

Example

my $err;
my $imageSize;
my $imageBytes;
my $filename = "screendump.png";

($err, $imageSize, $imageBytes) = VMCaptureScreenImage($vmHandle,
				       VIX_CAPTURESCREENFORMAT_PNG,
				       VIX_INVALID_HANDLE);
die "CaptureScreenImage failed, $err ", GetErrorText($err), "\n" if $err != VIX_ OK;

open IMAGE, ">", $filename or die "can't open screen capture file $filename";
print IMAGE $imagebytes;
close IMAGE;


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