FILTERKEYS
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| cbSize | DWORD | 4 | +0 | +0 | 構造体のサイズをバイト単位で指定します。 | ||||||||||||||||
| dwFlags | DWORD | 4 | +4 | +4 | FilterKeys 機能のプロパティを指定するビットフラグのセットです。次のビットフラグ値が定義されています。
| ||||||||||||||||
| iWaitMSec | DWORD | 4 | +8 | +8 | コンピューターがキーを受け入れるまでに、ユーザーがそのキーを押し続けなければならない時間をミリ秒単位で指定します。 | ||||||||||||||||
| iDelayMSec | DWORD | 4 | +12 | +12 | キーのリピートが開始されるまでに、ユーザーがそのキーを押し続けなければならない時間をミリ秒単位で指定します。 | ||||||||||||||||
| iRepeatMSec | DWORD | 4 | +16 | +16 | キーストロークのリピート間隔をミリ秒単位で指定します。 | ||||||||||||||||
| iBounceMSec | DWORD | 4 | +20 | +20 | キーを離してから、同じキーの次の押下をコンピューターが受け入れるまでに経過しなければならない時間をミリ秒単位で指定します。 |
公式ドキュメント
FilterKeys ユーザー補助機能に関する情報を格納します。この機能により、障碍のあるユーザーがキーボードのリピート速度 (RepeatKeys)、受け入れ遅延 (SlowKeys)、バウンス速度 (BounceKeys) を設定できます。
解説(Remarks)
uiAction パラメーターに SPI_GETFILTERKEYS または SPI_SETFILTERKEYS 値を設定して SystemParametersInfo 関数を呼び出すときに、FILTERKEYS 構造体を使用します。SPI_GETFILTERKEYS を使用する場合は、FILTERKEYS 構造体の cbSize メンバーを指定する必要があります。残りのメンバーは SystemParametersInfo 関数が設定します。SPI_SETFILTERKEYS 値を使用する場合は、すべての構造体メンバーを指定します。
iBounceMSec メンバーは BounceKeys 機能を制御し、iWaitMSec、iDelayMSec、iRepeatMSec の各メンバーは連携して RepeatKeys 機能と SlowKeys 機能を制御します。BounceKeys がオンの場合 (つまり iBounceMSec が 0 以外の場合)、RepeatKeys 機能と SlowKeys 機能はオフになります (つまり iWaitMSec、iDelayMSec、iRepeatMSec の各メンバーはすべて 0 でなければなりません)。同様に、BounceKeys がオフの場合 (iBounceMSec が 0 の場合)、iWaitMSec、iDelayMSec、iRepeatMSec はすべて 0 以外でなければなりません。
iBounceMSec、iWaitMSec、iDelayMSec、iRepeatMSec の各メンバーの最大値は 20,000 ミリ秒です。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での定義
#include <windows.h>
// FILTERKEYS (x64 24 / x86 24 バイト)
typedef struct FILTERKEYS {
DWORD cbSize;
DWORD dwFlags;
DWORD iWaitMSec;
DWORD iDelayMSec;
DWORD iRepeatMSec;
DWORD iBounceMSec;
} FILTERKEYS;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct FILTERKEYS
{
public uint cbSize;
public uint dwFlags;
public uint iWaitMSec;
public uint iDelayMSec;
public uint iRepeatMSec;
public uint iBounceMSec;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure FILTERKEYS
Public cbSize As UInteger
Public dwFlags As UInteger
Public iWaitMSec As UInteger
Public iDelayMSec As UInteger
Public iRepeatMSec As UInteger
Public iBounceMSec As UInteger
End Structureimport ctypes
from ctypes import wintypes
class FILTERKEYS(ctypes.Structure):
_fields_ = [
("cbSize", wintypes.DWORD),
("dwFlags", wintypes.DWORD),
("iWaitMSec", wintypes.DWORD),
("iDelayMSec", wintypes.DWORD),
("iRepeatMSec", wintypes.DWORD),
("iBounceMSec", wintypes.DWORD),
]#[repr(C)]
pub struct FILTERKEYS {
pub cbSize: u32,
pub dwFlags: u32,
pub iWaitMSec: u32,
pub iDelayMSec: u32,
pub iRepeatMSec: u32,
pub iBounceMSec: u32,
}import "golang.org/x/sys/windows"
type FILTERKEYS struct {
cbSize uint32
dwFlags uint32
iWaitMSec uint32
iDelayMSec uint32
iRepeatMSec uint32
iBounceMSec uint32
}type
FILTERKEYS = record
cbSize: DWORD;
dwFlags: DWORD;
iWaitMSec: DWORD;
iDelayMSec: DWORD;
iRepeatMSec: DWORD;
iBounceMSec: DWORD;
end;const FILTERKEYS = extern struct {
cbSize: u32,
dwFlags: u32,
iWaitMSec: u32,
iDelayMSec: u32,
iRepeatMSec: u32,
iBounceMSec: u32,
};type
FILTERKEYS {.bycopy.} = object
cbSize: uint32
dwFlags: uint32
iWaitMSec: uint32
iDelayMSec: uint32
iRepeatMSec: uint32
iBounceMSec: uint32struct FILTERKEYS
{
uint cbSize;
uint dwFlags;
uint iWaitMSec;
uint iDelayMSec;
uint iRepeatMSec;
uint iBounceMSec;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; FILTERKEYS サイズ: 24 バイト(x64)
dim st, 6 ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; cbSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwFlags : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; iWaitMSec : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; iDelayMSec : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; iRepeatMSec : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; iBounceMSec : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global FILTERKEYS
#field int cbSize
#field int dwFlags
#field int iWaitMSec
#field int iDelayMSec
#field int iRepeatMSec
#field int iBounceMSec
#endstruct
stdim st, FILTERKEYS ; NSTRUCT 変数を確保
st->cbSize = 100
mes "cbSize=" + st->cbSize