Microsoft DirectX 8.1 (Visual Basic)

Direct3D8.GetAdapterMonitor

Returns the handle of the monitor associated with the Microsoft® Direct3D® object.

object.GetAdapterMonitor( _ 
    Adapter As Long) As Long

Parts

object
Object expression that resolves to a Direct3D8 object.
Adapter
Ordinal number that denotes the display adapter. D3DADAPTER_DEFAULT is always the primary display adapter.

Return Values

Handle of the monitor associated with the Direct3D object.

Error Codes

If the method fails, an error is raised and Err.Number can be set to one of the following values.

D3DERR_INVALIDCALL
D3DERR_OUTOFVIDEOMEMORY

For information on trapping errors, see the Microsoft® Visual Basic® Error Handling topic.

Remarks

As shown in the following code fragment, which illustrates how to obtain a handle to the monitor associated with a given device, use Direct3DDevice8.GetDirect3D to return the Direct3D enumerator from the device, and use Direct3DDevice8.GetCreationParameters to retrieve the value for Adapter.

    Dim Device As Direct3DDevice8, D3D As Direct3DDevice8
    Dim Parameters As D3DDEVICE_CREATION_PARAMETERS
    Dim MonitorHandle As Long
    
    ' The following code fragment assumes that the above items have been properly created and initialized
    If ((Device.GetCreationParameters(Parameters) <= 0) And (Device.GetDirect3D(D3D) <= 0)) Then
        MonitorHandle = D3D.GetAdapterMonitor(Parameters.AdapterOrdinal)
    Else
        ' Error handling code here
    End If

See Also

Direct3DDevice8.GetCreationParameters, Direct3DDevice8.GetDirect3D