ホーム › Devices.HumanInterfaceDevice › DIDEVICEINSTANCE_DX3W
DIDEVICEINSTANCE_DX3W
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| dwSize | DWORD | 4 | +0 | +0 | この構造体のバイトサイズ。DirectX3世代の版を識別する。 |
| guidInstance | GUID | 16 | +4 | +4 | デバイスインスタンスを一意に識別するGUID。 |
| guidProduct | GUID | 16 | +20 | +20 | デバイス製品を識別するGUID。 |
| dwDevType | DWORD | 4 | +36 | +36 | デバイス種別を示す値。 |
| tszInstanceName | WCHAR | 520 | +40 | +40 | デバイスインスタンス名を示すワイド文字列。 |
| tszProductName | WCHAR | 520 | +560 | +560 | デバイス製品名を示すワイド文字列。 |
各言語での定義
#include <windows.h>
// DIDEVICEINSTANCE_DX3W (x64 1080 / x86 1080 バイト)
typedef struct DIDEVICEINSTANCE_DX3W {
DWORD dwSize;
GUID guidInstance;
GUID guidProduct;
DWORD dwDevType;
WCHAR tszInstanceName[260];
WCHAR tszProductName[260];
} DIDEVICEINSTANCE_DX3W;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DIDEVICEINSTANCE_DX3W
{
public uint dwSize;
public Guid guidInstance;
public Guid guidProduct;
public uint dwDevType;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] public string tszInstanceName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] public string tszProductName;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DIDEVICEINSTANCE_DX3W
Public dwSize As UInteger
Public guidInstance As Guid
Public guidProduct As Guid
Public dwDevType As UInteger
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=260)> Public tszInstanceName As String
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=260)> Public tszProductName As String
End Structureimport ctypes
from ctypes import wintypes
class DIDEVICEINSTANCE_DX3W(ctypes.Structure):
_fields_ = [
("dwSize", wintypes.DWORD),
("guidInstance", GUID),
("guidProduct", GUID),
("dwDevType", wintypes.DWORD),
("tszInstanceName", ctypes.c_wchar * 260),
("tszProductName", ctypes.c_wchar * 260),
]#[repr(C)]
pub struct DIDEVICEINSTANCE_DX3W {
pub dwSize: u32,
pub guidInstance: GUID,
pub guidProduct: GUID,
pub dwDevType: u32,
pub tszInstanceName: [u16; 260],
pub tszProductName: [u16; 260],
}import "golang.org/x/sys/windows"
type DIDEVICEINSTANCE_DX3W struct {
dwSize uint32
guidInstance windows.GUID
guidProduct windows.GUID
dwDevType uint32
tszInstanceName [260]uint16
tszProductName [260]uint16
}type
DIDEVICEINSTANCE_DX3W = record
dwSize: DWORD;
guidInstance: TGUID;
guidProduct: TGUID;
dwDevType: DWORD;
tszInstanceName: array[0..259] of WideChar;
tszProductName: array[0..259] of WideChar;
end;const DIDEVICEINSTANCE_DX3W = extern struct {
dwSize: u32,
guidInstance: GUID,
guidProduct: GUID,
dwDevType: u32,
tszInstanceName: [260]u16,
tszProductName: [260]u16,
};type
DIDEVICEINSTANCE_DX3W {.bycopy.} = object
dwSize: uint32
guidInstance: GUID
guidProduct: GUID
dwDevType: uint32
tszInstanceName: array[260, uint16]
tszProductName: array[260, uint16]struct DIDEVICEINSTANCE_DX3W
{
uint dwSize;
GUID guidInstance;
GUID guidProduct;
uint dwDevType;
wchar[260] tszInstanceName;
wchar[260] tszProductName;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DIDEVICEINSTANCE_DX3W サイズ: 1080 バイト(x64)
dim st, 270 ; 4byte整数×270(構造体サイズ 1080 / 4 切り上げ)
; dwSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; guidInstance : GUID (+4, 16byte) varptr(st)+4 を基点に操作(16byte:入れ子/配列)
; guidProduct : GUID (+20, 16byte) varptr(st)+20 を基点に操作(16byte:入れ子/配列)
; dwDevType : DWORD (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; tszInstanceName : WCHAR (+40, 520byte) varptr(st)+40 を基点に操作(520byte:入れ子/配列)
; tszProductName : WCHAR (+560, 520byte) varptr(st)+560 を基点に操作(520byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global GUID, pack=1
#field int Data1
#field short Data2
#field short Data3
#field byte Data4 8
#endstruct
#defstruct global DIDEVICEINSTANCE_DX3W
#field int dwSize
#field GUID guidInstance
#field GUID guidProduct
#field int dwDevType
#field wchar tszInstanceName 260
#field wchar tszProductName 260
#endstruct
stdim st, DIDEVICEINSTANCE_DX3W ; NSTRUCT 変数を確保
st->dwSize = 100
mes "dwSize=" + st->dwSize