Win32 API 日本語リファレンス
ホームMedia.KernelStreaming › CC_BYTE_PAIR

CC_BYTE_PAIR

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

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

フィールド

フィールドサイズx64x86説明
DecodedBYTE2+0+0デコード済みのクローズドキャプション2バイトデータを示す。
ReservedWORD2+2+2予約フィールドで、0を設定する。

各言語での定義

#include <windows.h>

// CC_BYTE_PAIR  (x64 4 / x86 4 バイト)
typedef struct CC_BYTE_PAIR {
    BYTE Decoded[2];
    WORD Reserved;
} CC_BYTE_PAIR;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CC_BYTE_PAIR
{
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] Decoded;
    public ushort Reserved;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CC_BYTE_PAIR
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)> Public Decoded() As Byte
    Public Reserved As UShort
End Structure
import ctypes
from ctypes import wintypes

class CC_BYTE_PAIR(ctypes.Structure):
    _fields_ = [
        ("Decoded", ctypes.c_ubyte * 2),
        ("Reserved", ctypes.c_ushort),
    ]
#[repr(C)]
pub struct CC_BYTE_PAIR {
    pub Decoded: [u8; 2],
    pub Reserved: u16,
}
import "golang.org/x/sys/windows"

type CC_BYTE_PAIR struct {
	Decoded [2]byte
	Reserved uint16
}
type
  CC_BYTE_PAIR = record
    Decoded: array[0..1] of Byte;
    Reserved: Word;
  end;
const CC_BYTE_PAIR = extern struct {
    Decoded: [2]u8,
    Reserved: u16,
};
type
  CC_BYTE_PAIR {.bycopy.} = object
    Decoded: array[2, uint8]
    Reserved: uint16
struct CC_BYTE_PAIR
{
    ubyte[2] Decoded;
    ushort Reserved;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; CC_BYTE_PAIR サイズ: 4 バイト(x64)
dim st, 1    ; 4byte整数×1(構造体サイズ 4 / 4 切り上げ)
; Decoded : BYTE (+0, 2byte)  varptr(st)+0 を基点に操作(2byte:入れ子/配列)
; Reserved : WORD (+2, 2byte)  wpoke st,2,値  /  値 = wpeek(st,2)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global CC_BYTE_PAIR
    #field byte Decoded 2
    #field short Reserved
#endstruct

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