ホーム › UI.TabletPC › SYSTEM_EVENT_DATA
SYSTEM_EVENT_DATA
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| bModifier | BYTE | 1 | +0 | +0 | イベント時の修飾キー状態を示すビット値。 |
| wKey | WCHAR | 2 | +2 | +2 | 押下されたキーの文字コード。 |
| xPos | INT | 4 | +4 | +4 | イベント発生時のX座標。 |
| yPos | INT | 4 | +8 | +8 | イベント発生時のY座標。 |
| bCursorMode | BYTE | 1 | +12 | +12 | カーソル(ペン)のモードを示す値。 |
| dwButtonState | DWORD | 4 | +16 | +16 | ボタンの押下状態を示すフラグ。 |
各言語での定義
#include <windows.h>
// SYSTEM_EVENT_DATA (x64 20 / x86 20 バイト)
typedef struct SYSTEM_EVENT_DATA {
BYTE bModifier;
WCHAR wKey;
INT xPos;
INT yPos;
BYTE bCursorMode;
DWORD dwButtonState;
} SYSTEM_EVENT_DATA;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SYSTEM_EVENT_DATA
{
public byte bModifier;
public char wKey;
public int xPos;
public int yPos;
public byte bCursorMode;
public uint dwButtonState;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SYSTEM_EVENT_DATA
Public bModifier As Byte
Public wKey As Char
Public xPos As Integer
Public yPos As Integer
Public bCursorMode As Byte
Public dwButtonState As UInteger
End Structureimport ctypes
from ctypes import wintypes
class SYSTEM_EVENT_DATA(ctypes.Structure):
_fields_ = [
("bModifier", ctypes.c_ubyte),
("wKey", ctypes.c_wchar),
("xPos", ctypes.c_int),
("yPos", ctypes.c_int),
("bCursorMode", ctypes.c_ubyte),
("dwButtonState", wintypes.DWORD),
]#[repr(C)]
pub struct SYSTEM_EVENT_DATA {
pub bModifier: u8,
pub wKey: u16,
pub xPos: i32,
pub yPos: i32,
pub bCursorMode: u8,
pub dwButtonState: u32,
}import "golang.org/x/sys/windows"
type SYSTEM_EVENT_DATA struct {
bModifier byte
wKey uint16
xPos int32
yPos int32
bCursorMode byte
dwButtonState uint32
}type
SYSTEM_EVENT_DATA = record
bModifier: Byte;
wKey: WideChar;
xPos: Integer;
yPos: Integer;
bCursorMode: Byte;
dwButtonState: DWORD;
end;const SYSTEM_EVENT_DATA = extern struct {
bModifier: u8,
wKey: u16,
xPos: i32,
yPos: i32,
bCursorMode: u8,
dwButtonState: u32,
};type
SYSTEM_EVENT_DATA {.bycopy.} = object
bModifier: uint8
wKey: uint16
xPos: int32
yPos: int32
bCursorMode: uint8
dwButtonState: uint32struct SYSTEM_EVENT_DATA
{
ubyte bModifier;
wchar wKey;
int xPos;
int yPos;
ubyte bCursorMode;
uint dwButtonState;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SYSTEM_EVENT_DATA サイズ: 20 バイト(x64)
dim st, 5 ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; bModifier : BYTE (+0, 1byte) poke st,0,値 / 値 = peek(st,0)
; wKey : WCHAR (+2, 2byte) wpoke st,2,値 / 値 = wpeek(st,2)
; xPos : INT (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; yPos : INT (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; bCursorMode : BYTE (+12, 1byte) poke st,12,値 / 値 = peek(st,12)
; dwButtonState : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global SYSTEM_EVENT_DATA
#field byte bModifier
#field short wKey
#field int xPos
#field int yPos
#field byte bCursorMode
#field int dwButtonState
#endstruct
stdim st, SYSTEM_EVENT_DATA ; NSTRUCT 変数を確保
st->bModifier = 100
mes "bModifier=" + st->bModifier