Επεξεργασία

Κοινή χρήση μέσω


IVMSerialPort::Configure method

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

Configures the serial port.

Syntax

HRESULT Configure(
  [in] VMSerialPortType portType,
  [in] BSTR             portName,
  [in] VARIANT_BOOL     vmConnectImmediately
);

Parameters

portType [in]

The type of serial port. For a list of values, see VMSerialPortType.

portName [in]

The name of the serial port. For example, "COM1" for vmSerialPort_HostPort, "C:\SerialPort.txt" for vmSerialPort_TextFile, or "\\servername\pipe\pipename" for vmSerialPort_NamedPipe.

vmConnectImmediately [in]

TRUE if the host serial port should be opened immediately when the virtual machine is started and FALSE otherwise. Ignored if portType is not vmSerialPort_HostPort.

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 portType parameter is not valid.
DISP_E_EXCEPTION
0x80020009
An unexpected error has occurred.
E_POINTER
0x80004003
The portName parameter is NULL.
HRESULT_FROM_WIN32(ERROR_OUTOFMEMORY)
0x8007000e
There is not enough memory available to complete this request.
HRESULT_FROM_WIN32(ERROR_BUFFER_OVERFLOW)
0x8007006f
The path specified by the portName parameter is too long. The path must be less than MAX_PATH (260) characters.
HRESULT_FROM_WIN32(ERROR_INVALID_NAME)
0x8007007b
The portName parameter contains an invalid character (one of "*?<>/|":").
HRESULT_FROM_WIN32(ERROR_BAD_PATHNAME)
0x800700a1
The portName parameter specifies an empty or relative path. An absolute path is required.
VM_E_VM_UNKNOWN
0xA0040207
The configuration for this virtual machine is not valid.
VM_E_PREF_ILLEGAL_VALUE
0xA0040301
The specified port is already in use.

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_IVMSerialPort is defined as 2ce4460d-1d3f-4458-bf8b-44084b816815

See also

IVMSerialPort