Win32 API 日本語リファレンス
ホームSystem.WindowsSync › ID_PARAMETERS

ID_PARAMETERS

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

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

フィールド

フィールドサイズx64x86説明
dwSizeDWORD4+0+0本構造体のバイトサイズで、初期化時に設定する。
replicaIdID_PARAMETER_PAIR8+4+4レプリカIDのサイズ/可変長設定を示すID_PARAMETER_PAIR。
itemIdID_PARAMETER_PAIR8+12+12アイテムIDのサイズ/可変長設定を示すID_PARAMETER_PAIR。
changeUnitIdID_PARAMETER_PAIR8+20+20変更単位IDのサイズ/可変長設定を示すID_PARAMETER_PAIR。

各言語での定義

#include <windows.h>

// ID_PARAMETER_PAIR  (x64 8 / x86 8 バイト)
typedef struct ID_PARAMETER_PAIR {
    BOOL fIsVariable;
    WORD cbIdSize;
} ID_PARAMETER_PAIR;

// ID_PARAMETERS  (x64 28 / x86 28 バイト)
typedef struct ID_PARAMETERS {
    DWORD dwSize;
    ID_PARAMETER_PAIR replicaId;
    ID_PARAMETER_PAIR itemId;
    ID_PARAMETER_PAIR changeUnitId;
} ID_PARAMETERS;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct ID_PARAMETER_PAIR
{
    [MarshalAs(UnmanagedType.Bool)] public bool fIsVariable;
    public ushort cbIdSize;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct ID_PARAMETERS
{
    public uint dwSize;
    public ID_PARAMETER_PAIR replicaId;
    public ID_PARAMETER_PAIR itemId;
    public ID_PARAMETER_PAIR changeUnitId;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure ID_PARAMETER_PAIR
    <MarshalAs(UnmanagedType.Bool)> Public fIsVariable As Boolean
    Public cbIdSize As UShort
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure ID_PARAMETERS
    Public dwSize As UInteger
    Public replicaId As ID_PARAMETER_PAIR
    Public itemId As ID_PARAMETER_PAIR
    Public changeUnitId As ID_PARAMETER_PAIR
End Structure
import ctypes
from ctypes import wintypes

class ID_PARAMETER_PAIR(ctypes.Structure):
    _fields_ = [
        ("fIsVariable", wintypes.BOOL),
        ("cbIdSize", ctypes.c_ushort),
    ]

class ID_PARAMETERS(ctypes.Structure):
    _fields_ = [
        ("dwSize", wintypes.DWORD),
        ("replicaId", ID_PARAMETER_PAIR),
        ("itemId", ID_PARAMETER_PAIR),
        ("changeUnitId", ID_PARAMETER_PAIR),
    ]
#[repr(C)]
pub struct ID_PARAMETER_PAIR {
    pub fIsVariable: i32,
    pub cbIdSize: u16,
}

#[repr(C)]
pub struct ID_PARAMETERS {
    pub dwSize: u32,
    pub replicaId: ID_PARAMETER_PAIR,
    pub itemId: ID_PARAMETER_PAIR,
    pub changeUnitId: ID_PARAMETER_PAIR,
}
import "golang.org/x/sys/windows"

type ID_PARAMETER_PAIR struct {
	fIsVariable int32
	cbIdSize uint16
}

type ID_PARAMETERS struct {
	dwSize uint32
	replicaId ID_PARAMETER_PAIR
	itemId ID_PARAMETER_PAIR
	changeUnitId ID_PARAMETER_PAIR
}
type
  ID_PARAMETER_PAIR = record
    fIsVariable: BOOL;
    cbIdSize: Word;
  end;

  ID_PARAMETERS = record
    dwSize: DWORD;
    replicaId: ID_PARAMETER_PAIR;
    itemId: ID_PARAMETER_PAIR;
    changeUnitId: ID_PARAMETER_PAIR;
  end;
const ID_PARAMETER_PAIR = extern struct {
    fIsVariable: i32,
    cbIdSize: u16,
};

const ID_PARAMETERS = extern struct {
    dwSize: u32,
    replicaId: ID_PARAMETER_PAIR,
    itemId: ID_PARAMETER_PAIR,
    changeUnitId: ID_PARAMETER_PAIR,
};
type
  ID_PARAMETER_PAIR {.bycopy.} = object
    fIsVariable: int32
    cbIdSize: uint16

  ID_PARAMETERS {.bycopy.} = object
    dwSize: uint32
    replicaId: ID_PARAMETER_PAIR
    itemId: ID_PARAMETER_PAIR
    changeUnitId: ID_PARAMETER_PAIR
struct ID_PARAMETER_PAIR
{
    int fIsVariable;
    ushort cbIdSize;
}

struct ID_PARAMETERS
{
    uint dwSize;
    ID_PARAMETER_PAIR replicaId;
    ID_PARAMETER_PAIR itemId;
    ID_PARAMETER_PAIR changeUnitId;
}

HSP用 定義

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

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

#defstruct global ID_PARAMETERS
    #field int dwSize
    #field ID_PARAMETER_PAIR replicaId
    #field ID_PARAMETER_PAIR itemId
    #field ID_PARAMETER_PAIR changeUnitId
#endstruct

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