VixHandle
VixVM_CaptureScreenImage(VixHandle vmHandle,
int captureType,
VixHandle additionalProperties,
VixEventProc *callbackProc,
void *clientdata);
This function captures the screen of the guest operating system.
The image size is also available as a separate job result property.
These properties are available from the job handle as a result of the function call:
For security reasons, this function requires a successful call to VixVM_LoginInGuest must be made.
job = VixVM_CaptureScreenImage(vm,
VIX_CAPTURESCREENFORMAT_PNG,
VIX_INVALID_HANDLE,
NULL,
NULL);
err = VixJob_Wait(job,
VIX_PROPERTY_JOB_RESULT_SCREEN_IMAGE_DATA,
&byte_count, &screen_bits,
VIX_PROPERTY_NONE);
if (VIX_OK != err) {
fprintf(stderr, "failed to capture screen in guest vm '%s'(%"FMT64"d %s)\n",
vmpath,
err,
Vix_GetErrorText(err, NULL));
goto abort;
}
Vix_ReleaseHandle(job);
printf("got image back, %d bytes\n", byte_count);
FILE *fp = fopen("screen.png", "wb+");
if (fp) {
fwrite(screen_bits, byte_count, 1, fp);
fclose(fp);
}
// Free blob memory when done.
Vix_FreeBuffer(screen_bits);