vm.go
func (v *VM) Screenshot() ([]byte, error) {
	var jobHandle C.VixHandle = C.VIX_INVALID_HANDLE
	var err C.VixError = C.VIX_OK
	var byteCount C.int
	var screenBits C.char

	jobHandle = C.VixVM_CaptureScreenImage(v.handle,
		C.VIX_CAPTURESCREENFORMAT_PNG,
		C.VIX_INVALID_HANDLE,
		nil,
		nil)
	defer C.Vix_ReleaseHandle(jobHandle)

	err = C.get_screenshot_bytes(jobHandle, &byteCount, &screenBits)
	defer C.Vix_FreeBuffer(unsafe.Pointer(&screenBits))

	if C.VIX_OK != err {
		return nil, &Error{
			Operation: "vm.Screenshot",
			Code:      int(err & 0xFFFF),
			Text:      C.GoString(C.Vix_GetErrorText(err, nil)),
		}
	}

	return C.GoBytes(unsafe.Pointer(&screenBits), byteCount), nil
}
func (v *VM) Screenshot() ([]byte, error) {
	var jobHandle C.VixHandle = C.VIX_INVALID_HANDLE
	var err C.VixError = C.VIX_OK
	var byteCount C.int
	var screenBits C.char

	jobHandle = C.VixVM_CaptureScreenImage(v.handle,
		C.VIX_CAPTURESCREENFORMAT_PNG,
		C.VIX_INVALID_HANDLE,
		nil,
		nil)
	defer C.Vix_ReleaseHandle(jobHandle)

	err = C.get_screenshot_bytes(jobHandle, &byteCount, &screenBits)
	defer C.Vix_FreeBuffer(unsafe.Pointer(&screenBits))

	if C.VIX_OK != err {
		return nil, &Error{
			Operation: "vm.Screenshot",
			Code:      int(err & 0xFFFF),
			Text:      C.GoString(C.Vix_GetErrorText(err, nil)),
		}
	}

	return C.GoBytes(unsafe.Pointer(&screenBits), byteCount), nil
}
// Screenshot captures the screen of the guest operating system.
//
// Remarks:
//
//   * This function captures the current screen image and returns it as a
//     []byte result.
//
//   * For security reasons, this function requires a successful call to
//     VM.LoginInGuest() must be made.
//
// Since VMware Workstation 6.5
// Minimum Supported Guest OS: Microsoft Windows NT Series, Linux
//