IVMDisplay::SetDimensions method

[Windows Virtual PC is no longer available for use as of Windows 8. Instead, use the Hyper-V WMI provider (V2).]

Sets the height and width of the virtual machine's (VM's) display, in pixels.

Syntax

HRESULT SetDimensions(
  [in] long displayPixelWidth,
  [in] long displayPixelHeight
);

Parameters

displayPixelWidth [in]

The width, in pixels. The value must be between the values of 640 and 2048. If the value is not evenly divisible by 8, then it will be reduced to the next lower multiple of 8.

displayPixelHeight [in]

The height, in pixels. The value must be between the values of 480 and 1920.

Return value

This method can return one of these values.

Return code/value Description
S_OK
0
The operation was successful.
E_INVALIDARG
0x80000003
The displayPixelWidth parameter is not evenly divisible by 8 or the displayPixelWidth or displayPixelHeight parameter is outside of the allowed minimum (640x480) or maximum 2048x1920) values.
VM_E_TIMED_OUT
0xA0040202
The resolution change did not finish in a timely manner.
VM_E_VM_NOT_RUNNING
0xA0040206
The virtual machine must be running for this operation.
VM_E_VM_UNKNOWN
0xA0040207
The virtual machine is not valid or is not currently running.
VM_E_NO_DISPLAY
0xA0040850
Unable to locate a valid display for the VM.
VM_E_ADDITIONS_FEATURE_NOT_AVAIL
0xA0040505
The version of the integration components installed in the guest operating system does not support this operation.
DISP_E_EXCEPTION
0x80020009
An unexpected error has occurred.

Remarks

The minimum size of the virtual machine's display is 640 x 480 pixels. The maximum size is 2048 x 1920. Attempts to set the display size to values outside these limits, or to any width not evenly divisible by 8, will result in an E_INVALIDARG error being returned.

Requirements

Requirement Value
Minimum supported client
Windows 7 [desktop apps only]
Minimum supported server
None supported
End of client support
Windows 7
Product
Windows Virtual PC
Header
VPCCOMInterfaces.h
IID
IID_IVMDisplay is defined as 960895e9-f743-4498-96aa-261f867e7fc5

See also

IVMDisplay