ホーム › Devices.Display › Sources
Sources
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| sourceId | DWORD | 4 | +0 | +0 | ソース(描画元)を識別する番号。アダプター内で一意。 |
| numTargets | INT | 4 | +4 | +4 | このソースに関連付けられたターゲット数。配列aTargetsの要素数。 |
| aTargets | DWORD | 4 | +8 | +8 | ソースに対応するターゲットID群を格納する配列(可変長)。 |
各言語での定義
#include <windows.h>
// Sources (x64 12 / x86 12 バイト)
typedef struct Sources {
DWORD sourceId;
INT numTargets;
DWORD aTargets[1];
} Sources;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct Sources
{
public uint sourceId;
public int numTargets;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public uint[] aTargets;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure Sources
Public sourceId As UInteger
Public numTargets As Integer
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public aTargets() As UInteger
End Structureimport ctypes
from ctypes import wintypes
class Sources(ctypes.Structure):
_fields_ = [
("sourceId", wintypes.DWORD),
("numTargets", ctypes.c_int),
("aTargets", wintypes.DWORD * 1),
]#[repr(C)]
pub struct Sources {
pub sourceId: u32,
pub numTargets: i32,
pub aTargets: [u32; 1],
}import "golang.org/x/sys/windows"
type Sources struct {
sourceId uint32
numTargets int32
aTargets [1]uint32
}type
Sources = record
sourceId: DWORD;
numTargets: Integer;
aTargets: array[0..0] of DWORD;
end;const Sources = extern struct {
sourceId: u32,
numTargets: i32,
aTargets: [1]u32,
};type
Sources {.bycopy.} = object
sourceId: uint32
numTargets: int32
aTargets: array[1, uint32]struct Sources
{
uint sourceId;
int numTargets;
uint[1] aTargets;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; Sources サイズ: 12 バイト(x64)
dim st, 3 ; 4byte整数×3(構造体サイズ 12 / 4 切り上げ)
; sourceId : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; numTargets : INT (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; aTargets : DWORD (+8, 4byte) varptr(st)+8 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global Sources
#field int sourceId
#field int numTargets
#field int aTargets 1
#endstruct
stdim st, Sources ; NSTRUCT 変数を確保
st->sourceId = 100
mes "sourceId=" + st->sourceId