#UseHook

フックを使用して、すべてまたは一部のキーボードホットキーを実装することを強制します。

#UseHook Setting

パラメータ

設定

省略されたときは、初期設定は<e4>True</e4>になります。Otherwise, specify one of the following literal values:

True または 1:The keyboard hook will be used to implement all keyboard hotkeys between here and the next #UseHook False (if any).

False または 0:ホットキーは、デフォルトの方法(可能であればRegisterHotkey()、そうでなければキーボードフック)を使って実装されます。

備考

If this directive is unspecified in the script, it will behave as though set to False, meaning the windows API function RegisterHotkey() is used to implement a keyboard hotkey whenever possible. However, the responsiveness of hotkeys might be better under some conditions if the keyboard hook is used instead.

このディレクティブをオンにすると、影響を受ける各ホットキーの定義に$ prefixを使用することと同じになります。

スクリプトの起動時に一度だけ処理される#ディレクティブと同様に、#UseHookはスクリプト内で関数のように配置するべきではありません(つまり、サブルーチン内に含める必要はありません)。代わりに、その影響を受けさせたい最初のホットキーの直前に配置します。

デフォルトでは、キーボードフックを使用するホットキーは、Send機能によってトリガーすることができません。同様に、すべてのマウスホットキーはマウスフックを使用するため、マウスホットキーはクリックなどの組み込み機能でトリガーすることはできません。回避策としては、ホットキーの機能に名前を付けて直接呼び出す方法があります。

#InputLevelSendLevelは、Send関数によってトリガーされるホットキーとホットストリングをさらにコントロールすることができます。

他のディレクティブと同様に、#UseHookは条件付きで実行することはできません。

InstallKeybdHook, InstallMouseHook, ListHotkeys, #InputLevel

最初の2つのホットキーがキーボードフックを使用するようにします。

#UseHook  ; この時点以降、ホットキーにフックを使用することを強制します。
#x::MsgBox "This hotkey will be implemented with the hook."
#y::MsgBox "And this one too."
#UseHook False
#z::MsgBox "But not this one."