ホーム › Devices.HumanInterfaceDevice › DIDATAFORMAT
DIDATAFORMAT
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| dwSize | DWORD | 4 | +0 | +0 | この構造体のバイトサイズ。 |
| dwObjSize | DWORD | 4 | +4 | +4 | 各DIOBJECTDATAFORMAT要素のバイトサイズ。 |
| dwFlags | DWORD | 4 | +8 | +8 | データ形式の属性を示すフラグ(絶対値/相対値等)。 |
| dwDataSize | DWORD | 4 | +12 | +12 | デバイスデータ全体のバイトサイズ。4の倍数とする。 |
| dwNumObjs | DWORD | 4 | +16 | +16 | rgodf配列に含まれるオブジェクト数。 |
| rgodf | DIOBJECTDATAFORMAT* | 8/4 | +24 | +20 | オブジェクトデータ形式の配列へのポインター。 |
各言語での定義
#include <windows.h>
// DIDATAFORMAT (x64 32 / x86 24 バイト)
typedef struct DIDATAFORMAT {
DWORD dwSize;
DWORD dwObjSize;
DWORD dwFlags;
DWORD dwDataSize;
DWORD dwNumObjs;
DIOBJECTDATAFORMAT* rgodf;
} DIDATAFORMAT;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DIDATAFORMAT
{
public uint dwSize;
public uint dwObjSize;
public uint dwFlags;
public uint dwDataSize;
public uint dwNumObjs;
public IntPtr rgodf;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DIDATAFORMAT
Public dwSize As UInteger
Public dwObjSize As UInteger
Public dwFlags As UInteger
Public dwDataSize As UInteger
Public dwNumObjs As UInteger
Public rgodf As IntPtr
End Structureimport ctypes
from ctypes import wintypes
class DIDATAFORMAT(ctypes.Structure):
_fields_ = [
("dwSize", wintypes.DWORD),
("dwObjSize", wintypes.DWORD),
("dwFlags", wintypes.DWORD),
("dwDataSize", wintypes.DWORD),
("dwNumObjs", wintypes.DWORD),
("rgodf", ctypes.c_void_p),
]#[repr(C)]
pub struct DIDATAFORMAT {
pub dwSize: u32,
pub dwObjSize: u32,
pub dwFlags: u32,
pub dwDataSize: u32,
pub dwNumObjs: u32,
pub rgodf: *mut core::ffi::c_void,
}import "golang.org/x/sys/windows"
type DIDATAFORMAT struct {
dwSize uint32
dwObjSize uint32
dwFlags uint32
dwDataSize uint32
dwNumObjs uint32
rgodf uintptr
}type
DIDATAFORMAT = record
dwSize: DWORD;
dwObjSize: DWORD;
dwFlags: DWORD;
dwDataSize: DWORD;
dwNumObjs: DWORD;
rgodf: Pointer;
end;const DIDATAFORMAT = extern struct {
dwSize: u32,
dwObjSize: u32,
dwFlags: u32,
dwDataSize: u32,
dwNumObjs: u32,
rgodf: ?*anyopaque,
};type
DIDATAFORMAT {.bycopy.} = object
dwSize: uint32
dwObjSize: uint32
dwFlags: uint32
dwDataSize: uint32
dwNumObjs: uint32
rgodf: pointerstruct DIDATAFORMAT
{
uint dwSize;
uint dwObjSize;
uint dwFlags;
uint dwDataSize;
uint dwNumObjs;
void* rgodf;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DIDATAFORMAT サイズ: 24 バイト(x86)
dim st, 6 ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; dwSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwObjSize : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; dwFlags : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; dwDataSize : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; dwNumObjs : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; rgodf : DIOBJECTDATAFORMAT* (+20, 4byte) varptr(st)+20 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DIDATAFORMAT サイズ: 32 バイト(x64)
dim st, 8 ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; dwSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwObjSize : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; dwFlags : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; dwDataSize : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; dwNumObjs : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; rgodf : DIOBJECTDATAFORMAT* (+24, 8byte) varptr(st)+24 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DIDATAFORMAT
#field int dwSize
#field int dwObjSize
#field int dwFlags
#field int dwDataSize
#field int dwNumObjs
#field intptr rgodf
#endstruct
stdim st, DIDATAFORMAT ; NSTRUCT 変数を確保
st->dwSize = 100
mes "dwSize=" + st->dwSize