Win32 API 日本語リファレンス
ホームDevices.HumanInterfaceDevice › DICONFIGUREDEVICESPARAMSA

DICONFIGUREDEVICESPARAMSA

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

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

フィールド

フィールドサイズx64x86説明
dwSizeDWORD4+0+0この構造体のバイトサイズ。
dwcUsersDWORD4+4+4構成対象のユーザー数。
lptszUserNamesLPSTR8/4+8+8改行区切りのユーザー名リストを示すASCII文字列。
dwcFormatsDWORD4+16+12アクション形式(lprgFormats)の数。
lprgFormatsDIACTIONFORMATA*8/4+24+16アクション形式定義の配列(DIACTIONFORMATA)へのポインター。
hwndHWND8/4+32+20構成UIの親ウィンドウハンドル。
dicsDICOLORSET36+40+24構成UIで使用する配色を指定するDICOLORSET構造体。
lpUnkDDSTargetIUnknown*8/4+80+60DirectDrawサーフェス対象のIUnknownインターフェイスへのポインター。

各言語での定義

#include <windows.h>

// DICOLORSET  (x64 36 / x86 36 バイト)
typedef struct DICOLORSET {
    DWORD dwSize;
    DWORD cTextFore;
    DWORD cTextHighlight;
    DWORD cCalloutLine;
    DWORD cCalloutHighlight;
    DWORD cBorder;
    DWORD cControlFill;
    DWORD cHighlightFill;
    DWORD cAreaFill;
} DICOLORSET;

// DICONFIGUREDEVICESPARAMSA  (x64 88 / x86 64 バイト)
typedef struct DICONFIGUREDEVICESPARAMSA {
    DWORD dwSize;
    DWORD dwcUsers;
    LPSTR lptszUserNames;
    DWORD dwcFormats;
    DIACTIONFORMATA* lprgFormats;
    HWND hwnd;
    DICOLORSET dics;
    IUnknown* lpUnkDDSTarget;
} DICONFIGUREDEVICESPARAMSA;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DICOLORSET
{
    public uint dwSize;
    public uint cTextFore;
    public uint cTextHighlight;
    public uint cCalloutLine;
    public uint cCalloutHighlight;
    public uint cBorder;
    public uint cControlFill;
    public uint cHighlightFill;
    public uint cAreaFill;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DICONFIGUREDEVICESPARAMSA
{
    public uint dwSize;
    public uint dwcUsers;
    public IntPtr lptszUserNames;
    public uint dwcFormats;
    public IntPtr lprgFormats;
    public IntPtr hwnd;
    public DICOLORSET dics;
    public IntPtr lpUnkDDSTarget;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DICOLORSET
    Public dwSize As UInteger
    Public cTextFore As UInteger
    Public cTextHighlight As UInteger
    Public cCalloutLine As UInteger
    Public cCalloutHighlight As UInteger
    Public cBorder As UInteger
    Public cControlFill As UInteger
    Public cHighlightFill As UInteger
    Public cAreaFill As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DICONFIGUREDEVICESPARAMSA
    Public dwSize As UInteger
    Public dwcUsers As UInteger
    Public lptszUserNames As IntPtr
    Public dwcFormats As UInteger
    Public lprgFormats As IntPtr
    Public hwnd As IntPtr
    Public dics As DICOLORSET
    Public lpUnkDDSTarget As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class DICOLORSET(ctypes.Structure):
    _fields_ = [
        ("dwSize", wintypes.DWORD),
        ("cTextFore", wintypes.DWORD),
        ("cTextHighlight", wintypes.DWORD),
        ("cCalloutLine", wintypes.DWORD),
        ("cCalloutHighlight", wintypes.DWORD),
        ("cBorder", wintypes.DWORD),
        ("cControlFill", wintypes.DWORD),
        ("cHighlightFill", wintypes.DWORD),
        ("cAreaFill", wintypes.DWORD),
    ]

class DICONFIGUREDEVICESPARAMSA(ctypes.Structure):
    _fields_ = [
        ("dwSize", wintypes.DWORD),
        ("dwcUsers", wintypes.DWORD),
        ("lptszUserNames", ctypes.c_void_p),
        ("dwcFormats", wintypes.DWORD),
        ("lprgFormats", ctypes.c_void_p),
        ("hwnd", ctypes.c_void_p),
        ("dics", DICOLORSET),
        ("lpUnkDDSTarget", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct DICOLORSET {
    pub dwSize: u32,
    pub cTextFore: u32,
    pub cTextHighlight: u32,
    pub cCalloutLine: u32,
    pub cCalloutHighlight: u32,
    pub cBorder: u32,
    pub cControlFill: u32,
    pub cHighlightFill: u32,
    pub cAreaFill: u32,
}

#[repr(C)]
pub struct DICONFIGUREDEVICESPARAMSA {
    pub dwSize: u32,
    pub dwcUsers: u32,
    pub lptszUserNames: *mut core::ffi::c_void,
    pub dwcFormats: u32,
    pub lprgFormats: *mut core::ffi::c_void,
    pub hwnd: *mut core::ffi::c_void,
    pub dics: DICOLORSET,
    pub lpUnkDDSTarget: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type DICOLORSET struct {
	dwSize uint32
	cTextFore uint32
	cTextHighlight uint32
	cCalloutLine uint32
	cCalloutHighlight uint32
	cBorder uint32
	cControlFill uint32
	cHighlightFill uint32
	cAreaFill uint32
}

type DICONFIGUREDEVICESPARAMSA struct {
	dwSize uint32
	dwcUsers uint32
	lptszUserNames uintptr
	dwcFormats uint32
	lprgFormats uintptr
	hwnd uintptr
	dics DICOLORSET
	lpUnkDDSTarget uintptr
}
type
  DICOLORSET = record
    dwSize: DWORD;
    cTextFore: DWORD;
    cTextHighlight: DWORD;
    cCalloutLine: DWORD;
    cCalloutHighlight: DWORD;
    cBorder: DWORD;
    cControlFill: DWORD;
    cHighlightFill: DWORD;
    cAreaFill: DWORD;
  end;

  DICONFIGUREDEVICESPARAMSA = record
    dwSize: DWORD;
    dwcUsers: DWORD;
    lptszUserNames: Pointer;
    dwcFormats: DWORD;
    lprgFormats: Pointer;
    hwnd: Pointer;
    dics: DICOLORSET;
    lpUnkDDSTarget: Pointer;
  end;
const DICOLORSET = extern struct {
    dwSize: u32,
    cTextFore: u32,
    cTextHighlight: u32,
    cCalloutLine: u32,
    cCalloutHighlight: u32,
    cBorder: u32,
    cControlFill: u32,
    cHighlightFill: u32,
    cAreaFill: u32,
};

const DICONFIGUREDEVICESPARAMSA = extern struct {
    dwSize: u32,
    dwcUsers: u32,
    lptszUserNames: ?*anyopaque,
    dwcFormats: u32,
    lprgFormats: ?*anyopaque,
    hwnd: ?*anyopaque,
    dics: DICOLORSET,
    lpUnkDDSTarget: ?*anyopaque,
};
type
  DICOLORSET {.bycopy.} = object
    dwSize: uint32
    cTextFore: uint32
    cTextHighlight: uint32
    cCalloutLine: uint32
    cCalloutHighlight: uint32
    cBorder: uint32
    cControlFill: uint32
    cHighlightFill: uint32
    cAreaFill: uint32

  DICONFIGUREDEVICESPARAMSA {.bycopy.} = object
    dwSize: uint32
    dwcUsers: uint32
    lptszUserNames: pointer
    dwcFormats: uint32
    lprgFormats: pointer
    hwnd: pointer
    dics: DICOLORSET
    lpUnkDDSTarget: pointer
struct DICOLORSET
{
    uint dwSize;
    uint cTextFore;
    uint cTextHighlight;
    uint cCalloutLine;
    uint cCalloutHighlight;
    uint cBorder;
    uint cControlFill;
    uint cHighlightFill;
    uint cAreaFill;
}

struct DICONFIGUREDEVICESPARAMSA
{
    uint dwSize;
    uint dwcUsers;
    void* lptszUserNames;
    uint dwcFormats;
    void* lprgFormats;
    void* hwnd;
    DICOLORSET dics;
    void* lpUnkDDSTarget;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DICONFIGUREDEVICESPARAMSA サイズ: 64 バイト(x86)
dim st, 16    ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; dwSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwcUsers : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; lptszUserNames : LPSTR (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; dwcFormats : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; lprgFormats : DIACTIONFORMATA* (+16, 4byte)  varptr(st)+16 を基点に操作(4byte:入れ子/配列)
; hwnd : HWND (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; dics : DICOLORSET (+24, 36byte)  varptr(st)+24 を基点に操作(36byte:入れ子/配列)
; lpUnkDDSTarget : IUnknown* (+60, 4byte)  st.15 = 値  /  値 = st.15   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DICONFIGUREDEVICESPARAMSA サイズ: 88 バイト(x64)
dim st, 22    ; 4byte整数×22(構造体サイズ 88 / 4 切り上げ)
; dwSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwcUsers : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; lptszUserNames : LPSTR (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; dwcFormats : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; lprgFormats : DIACTIONFORMATA* (+24, 8byte)  varptr(st)+24 を基点に操作(8byte:入れ子/配列)
; hwnd : HWND (+32, 8byte)  qpoke st,32,値 / qpeek(st,32)  ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; dics : DICOLORSET (+40, 36byte)  varptr(st)+40 を基点に操作(36byte:入れ子/配列)
; lpUnkDDSTarget : IUnknown* (+80, 8byte)  qpoke st,80,値 / qpeek(st,80)  ※IronHSPのみ。3.7/3.8は lpoke st,80,下位 : lpoke st,84,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global DICOLORSET
    #field int dwSize
    #field int cTextFore
    #field int cTextHighlight
    #field int cCalloutLine
    #field int cCalloutHighlight
    #field int cBorder
    #field int cControlFill
    #field int cHighlightFill
    #field int cAreaFill
#endstruct

#defstruct global DICONFIGUREDEVICESPARAMSA
    #field int dwSize
    #field int dwcUsers
    #field intptr lptszUserNames
    #field int dwcFormats
    #field intptr lprgFormats
    #field intptr hwnd
    #field DICOLORSET dics
    #field intptr lpUnkDDSTarget
#endstruct

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