Win32 API 日本語リファレンス
ホームGraphics.DirectComposition › COMPOSITION_TARGET_ID

COMPOSITION_TARGET_ID

構造体
サイズx64: 28 バイト / x86: 28 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
displayAdapterLuidLUID8+0+0表示出力を担うディスプレイアダプタのLUID。
renderAdapterLuidLUID8+8+8描画処理を行うアダプタのLUID。
vidPnSourceIdDWORD4+16+16VidPNのソース(描画元)識別子を示す。
vidPnTargetIdDWORD4+20+20VidPNのターゲット(出力先)識別子を示す。
uniqueIdDWORD4+24+24合成ターゲットを一意に識別する値。

各言語での定義

#include <windows.h>

// LUID  (x64 8 / x86 8 バイト)
typedef struct LUID {
    DWORD LowPart;
    INT HighPart;
} LUID;

// COMPOSITION_TARGET_ID  (x64 28 / x86 28 バイト)
typedef struct COMPOSITION_TARGET_ID {
    LUID displayAdapterLuid;
    LUID renderAdapterLuid;
    DWORD vidPnSourceId;
    DWORD vidPnTargetId;
    DWORD uniqueId;
} COMPOSITION_TARGET_ID;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct LUID
{
    public uint LowPart;
    public int HighPart;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct COMPOSITION_TARGET_ID
{
    public LUID displayAdapterLuid;
    public LUID renderAdapterLuid;
    public uint vidPnSourceId;
    public uint vidPnTargetId;
    public uint uniqueId;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure LUID
    Public LowPart As UInteger
    Public HighPart As Integer
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure COMPOSITION_TARGET_ID
    Public displayAdapterLuid As LUID
    Public renderAdapterLuid As LUID
    Public vidPnSourceId As UInteger
    Public vidPnTargetId As UInteger
    Public uniqueId As UInteger
End Structure
import ctypes
from ctypes import wintypes

class LUID(ctypes.Structure):
    _fields_ = [
        ("LowPart", wintypes.DWORD),
        ("HighPart", ctypes.c_int),
    ]

class COMPOSITION_TARGET_ID(ctypes.Structure):
    _fields_ = [
        ("displayAdapterLuid", LUID),
        ("renderAdapterLuid", LUID),
        ("vidPnSourceId", wintypes.DWORD),
        ("vidPnTargetId", wintypes.DWORD),
        ("uniqueId", wintypes.DWORD),
    ]
#[repr(C)]
pub struct LUID {
    pub LowPart: u32,
    pub HighPart: i32,
}

#[repr(C)]
pub struct COMPOSITION_TARGET_ID {
    pub displayAdapterLuid: LUID,
    pub renderAdapterLuid: LUID,
    pub vidPnSourceId: u32,
    pub vidPnTargetId: u32,
    pub uniqueId: u32,
}
import "golang.org/x/sys/windows"

type LUID struct {
	LowPart uint32
	HighPart int32
}

type COMPOSITION_TARGET_ID struct {
	displayAdapterLuid LUID
	renderAdapterLuid LUID
	vidPnSourceId uint32
	vidPnTargetId uint32
	uniqueId uint32
}
type
  LUID = record
    LowPart: DWORD;
    HighPart: Integer;
  end;

  COMPOSITION_TARGET_ID = record
    displayAdapterLuid: LUID;
    renderAdapterLuid: LUID;
    vidPnSourceId: DWORD;
    vidPnTargetId: DWORD;
    uniqueId: DWORD;
  end;
const LUID = extern struct {
    LowPart: u32,
    HighPart: i32,
};

const COMPOSITION_TARGET_ID = extern struct {
    displayAdapterLuid: LUID,
    renderAdapterLuid: LUID,
    vidPnSourceId: u32,
    vidPnTargetId: u32,
    uniqueId: u32,
};
type
  LUID {.bycopy.} = object
    LowPart: uint32
    HighPart: int32

  COMPOSITION_TARGET_ID {.bycopy.} = object
    displayAdapterLuid: LUID
    renderAdapterLuid: LUID
    vidPnSourceId: uint32
    vidPnTargetId: uint32
    uniqueId: uint32
struct LUID
{
    uint LowPart;
    int HighPart;
}

struct COMPOSITION_TARGET_ID
{
    LUID displayAdapterLuid;
    LUID renderAdapterLuid;
    uint vidPnSourceId;
    uint vidPnTargetId;
    uint uniqueId;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; COMPOSITION_TARGET_ID サイズ: 28 バイト(x64)
dim st, 7    ; 4byte整数×7(構造体サイズ 28 / 4 切り上げ)
; displayAdapterLuid : LUID (+0, 8byte)  varptr(st)+0 を基点に操作(8byte:入れ子/配列)
; renderAdapterLuid : LUID (+8, 8byte)  varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; vidPnSourceId : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; vidPnTargetId : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; uniqueId : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global LUID
    #field int LowPart
    #field int HighPart
#endstruct

#defstruct global COMPOSITION_TARGET_ID
    #field LUID displayAdapterLuid
    #field LUID renderAdapterLuid
    #field int vidPnSourceId
    #field int vidPnTargetId
    #field int uniqueId
#endstruct

stdim st, COMPOSITION_TARGET_ID        ; NSTRUCT 変数を確保
st->vidPnSourceId = 100
mes "vidPnSourceId=" + st->vidPnSourceId