ホーム › UI.Input.Pointer › POINTER_DEVICE_INFO
POINTER_DEVICE_INFO
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| displayOrientation | DWORD | 4 | +0 | +0 | デバイスが関連付くディスプレイの回転方向。 |
| device | HANDLE | 8/4 | +8 | +4 | ポインタデバイスのハンドル。 |
| pointerDeviceType | POINTER_DEVICE_TYPE | 4 | +16 | +8 | デバイス種別。統合タッチ・外付けペン等を示す。 |
| monitor | HMONITOR | 8/4 | +24 | +12 | デバイスがマッピングされるモニタのハンドル(HMONITOR)。 |
| startingCursorId | DWORD | 4 | +32 | +16 | このデバイスが割り当てるカーソルIDの開始値。 |
| maxActiveContacts | WORD | 2 | +36 | +20 | 同時に追跡可能な最大接触点数。 |
| productString | WCHAR | 1040 | +38 | +22 | デバイスの製品名文字列(NULL終端)。 |
各言語での定義
#include <windows.h>
// POINTER_DEVICE_INFO (x64 1080 / x86 1064 バイト)
typedef struct POINTER_DEVICE_INFO {
DWORD displayOrientation;
HANDLE device;
POINTER_DEVICE_TYPE pointerDeviceType;
HMONITOR monitor;
DWORD startingCursorId;
WORD maxActiveContacts;
WCHAR productString[520];
} POINTER_DEVICE_INFO;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct POINTER_DEVICE_INFO
{
public uint displayOrientation;
public IntPtr device;
public int pointerDeviceType;
public IntPtr monitor;
public uint startingCursorId;
public ushort maxActiveContacts;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 520)] public string productString;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure POINTER_DEVICE_INFO
Public displayOrientation As UInteger
Public device As IntPtr
Public pointerDeviceType As Integer
Public monitor As IntPtr
Public startingCursorId As UInteger
Public maxActiveContacts As UShort
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=520)> Public productString As String
End Structureimport ctypes
from ctypes import wintypes
class POINTER_DEVICE_INFO(ctypes.Structure):
_fields_ = [
("displayOrientation", wintypes.DWORD),
("device", ctypes.c_void_p),
("pointerDeviceType", ctypes.c_int),
("monitor", ctypes.c_void_p),
("startingCursorId", wintypes.DWORD),
("maxActiveContacts", ctypes.c_ushort),
("productString", ctypes.c_wchar * 520),
]#[repr(C)]
pub struct POINTER_DEVICE_INFO {
pub displayOrientation: u32,
pub device: *mut core::ffi::c_void,
pub pointerDeviceType: i32,
pub monitor: *mut core::ffi::c_void,
pub startingCursorId: u32,
pub maxActiveContacts: u16,
pub productString: [u16; 520],
}import "golang.org/x/sys/windows"
type POINTER_DEVICE_INFO struct {
displayOrientation uint32
device uintptr
pointerDeviceType int32
monitor uintptr
startingCursorId uint32
maxActiveContacts uint16
productString [520]uint16
}type
POINTER_DEVICE_INFO = record
displayOrientation: DWORD;
device: Pointer;
pointerDeviceType: Integer;
monitor: Pointer;
startingCursorId: DWORD;
maxActiveContacts: Word;
productString: array[0..519] of WideChar;
end;const POINTER_DEVICE_INFO = extern struct {
displayOrientation: u32,
device: ?*anyopaque,
pointerDeviceType: i32,
monitor: ?*anyopaque,
startingCursorId: u32,
maxActiveContacts: u16,
productString: [520]u16,
};type
POINTER_DEVICE_INFO {.bycopy.} = object
displayOrientation: uint32
device: pointer
pointerDeviceType: int32
monitor: pointer
startingCursorId: uint32
maxActiveContacts: uint16
productString: array[520, uint16]struct POINTER_DEVICE_INFO
{
uint displayOrientation;
void* device;
int pointerDeviceType;
void* monitor;
uint startingCursorId;
ushort maxActiveContacts;
wchar[520] productString;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; POINTER_DEVICE_INFO サイズ: 1064 バイト(x86)
dim st, 266 ; 4byte整数×266(構造体サイズ 1064 / 4 切り上げ)
; displayOrientation : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; device : HANDLE (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; pointerDeviceType : POINTER_DEVICE_TYPE (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; monitor : HMONITOR (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; startingCursorId : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; maxActiveContacts : WORD (+20, 2byte) wpoke st,20,値 / 値 = wpeek(st,20)
; productString : WCHAR (+22, 1040byte) varptr(st)+22 を基点に操作(1040byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; POINTER_DEVICE_INFO サイズ: 1080 バイト(x64)
dim st, 270 ; 4byte整数×270(構造体サイズ 1080 / 4 切り上げ)
; displayOrientation : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; device : HANDLE (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; pointerDeviceType : POINTER_DEVICE_TYPE (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; monitor : HMONITOR (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; startingCursorId : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; maxActiveContacts : WORD (+36, 2byte) wpoke st,36,値 / 値 = wpeek(st,36)
; productString : WCHAR (+38, 1040byte) varptr(st)+38 を基点に操作(1040byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global POINTER_DEVICE_INFO
#field int displayOrientation
#field intptr device
#field int pointerDeviceType
#field intptr monitor
#field int startingCursorId
#field short maxActiveContacts
#field wchar productString 520
#endstruct
stdim st, POINTER_DEVICE_INFO ; NSTRUCT 変数を確保
st->displayOrientation = 100
mes "displayOrientation=" + st->displayOrientation