ホーム › UI.Input.Ime › ImmGetHotKey
ImmGetHotKey
関数IMEホットキーの修飾子・仮想キー・キーボードレイアウトを取得する。
シグネチャ
// IMM32.dll
#include <windows.h>
BOOL ImmGetHotKey(
DWORD param0,
DWORD* lpuModifiers,
DWORD* lpuVKey,
HKL* phKL
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| param0 | DWORD | in |
| lpuModifiers | DWORD* | out |
| lpuVKey | DWORD* | out |
| phKL | HKL* | out |
戻り値の型: BOOL
各言語での呼び出し定義
// IMM32.dll
#include <windows.h>
BOOL ImmGetHotKey(
DWORD param0,
DWORD* lpuModifiers,
DWORD* lpuVKey,
HKL* phKL
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("IMM32.dll", ExactSpelling = true)]
static extern bool ImmGetHotKey(
uint param0, // DWORD
out uint lpuModifiers, // DWORD* out
out uint lpuVKey, // DWORD* out
IntPtr phKL // HKL* out
);<DllImport("IMM32.dll", ExactSpelling:=True)>
Public Shared Function ImmGetHotKey(
param0 As UInteger, ' DWORD
<Out> ByRef lpuModifiers As UInteger, ' DWORD* out
<Out> ByRef lpuVKey As UInteger, ' DWORD* out
phKL As IntPtr ' HKL* out
) As Boolean
End Function' param0 : DWORD
' lpuModifiers : DWORD* out
' lpuVKey : DWORD* out
' phKL : HKL* out
Declare PtrSafe Function ImmGetHotKey Lib "imm32" ( _
ByVal param0 As Long, _
ByRef lpuModifiers As Long, _
ByRef lpuVKey As Long, _
ByVal phKL As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ImmGetHotKey = ctypes.windll.imm32.ImmGetHotKey
ImmGetHotKey.restype = wintypes.BOOL
ImmGetHotKey.argtypes = [
wintypes.DWORD, # param0 : DWORD
ctypes.POINTER(wintypes.DWORD), # lpuModifiers : DWORD* out
ctypes.POINTER(wintypes.DWORD), # lpuVKey : DWORD* out
ctypes.c_void_p, # phKL : HKL* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('IMM32.dll')
ImmGetHotKey = Fiddle::Function.new(
lib['ImmGetHotKey'],
[
-Fiddle::TYPE_INT, # param0 : DWORD
Fiddle::TYPE_VOIDP, # lpuModifiers : DWORD* out
Fiddle::TYPE_VOIDP, # lpuVKey : DWORD* out
Fiddle::TYPE_VOIDP, # phKL : HKL* out
],
Fiddle::TYPE_INT)#[link(name = "imm32")]
extern "system" {
fn ImmGetHotKey(
param0: u32, // DWORD
lpuModifiers: *mut u32, // DWORD* out
lpuVKey: *mut u32, // DWORD* out
phKL: *mut *mut core::ffi::c_void // HKL* out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("IMM32.dll")]
public static extern bool ImmGetHotKey(uint param0, out uint lpuModifiers, out uint lpuVKey, IntPtr phKL);
"@
$api = Add-Type -MemberDefinition $sig -Name 'IMM32_ImmGetHotKey' -Namespace Win32 -PassThru
# $api::ImmGetHotKey(param0, lpuModifiers, lpuVKey, phKL)#uselib "IMM32.dll"
#func global ImmGetHotKey "ImmGetHotKey" sptr, sptr, sptr, sptr
; ImmGetHotKey param0, varptr(lpuModifiers), varptr(lpuVKey), phKL ; 戻り値は stat
; param0 : DWORD -> "sptr"
; lpuModifiers : DWORD* out -> "sptr"
; lpuVKey : DWORD* out -> "sptr"
; phKL : HKL* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "IMM32.dll" #cfunc global ImmGetHotKey "ImmGetHotKey" int, var, var, sptr ; res = ImmGetHotKey(param0, lpuModifiers, lpuVKey, phKL) ; param0 : DWORD -> "int" ; lpuModifiers : DWORD* out -> "var" ; lpuVKey : DWORD* out -> "var" ; phKL : HKL* out -> "sptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "IMM32.dll" #cfunc global ImmGetHotKey "ImmGetHotKey" int, sptr, sptr, sptr ; res = ImmGetHotKey(param0, varptr(lpuModifiers), varptr(lpuVKey), phKL) ; param0 : DWORD -> "int" ; lpuModifiers : DWORD* out -> "sptr" ; lpuVKey : DWORD* out -> "sptr" ; phKL : HKL* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL ImmGetHotKey(DWORD param0, DWORD* lpuModifiers, DWORD* lpuVKey, HKL* phKL) #uselib "IMM32.dll" #cfunc global ImmGetHotKey "ImmGetHotKey" int, var, var, intptr ; res = ImmGetHotKey(param0, lpuModifiers, lpuVKey, phKL) ; param0 : DWORD -> "int" ; lpuModifiers : DWORD* out -> "var" ; lpuVKey : DWORD* out -> "var" ; phKL : HKL* out -> "intptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL ImmGetHotKey(DWORD param0, DWORD* lpuModifiers, DWORD* lpuVKey, HKL* phKL) #uselib "IMM32.dll" #cfunc global ImmGetHotKey "ImmGetHotKey" int, intptr, intptr, intptr ; res = ImmGetHotKey(param0, varptr(lpuModifiers), varptr(lpuVKey), phKL) ; param0 : DWORD -> "int" ; lpuModifiers : DWORD* out -> "intptr" ; lpuVKey : DWORD* out -> "intptr" ; phKL : HKL* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
imm32 = windows.NewLazySystemDLL("IMM32.dll")
procImmGetHotKey = imm32.NewProc("ImmGetHotKey")
)
// param0 (DWORD), lpuModifiers (DWORD* out), lpuVKey (DWORD* out), phKL (HKL* out)
r1, _, err := procImmGetHotKey.Call(
uintptr(param0),
uintptr(lpuModifiers),
uintptr(lpuVKey),
uintptr(phKL),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction ImmGetHotKey(
param0: DWORD; // DWORD
lpuModifiers: Pointer; // DWORD* out
lpuVKey: Pointer; // DWORD* out
phKL: Pointer // HKL* out
): BOOL; stdcall;
external 'IMM32.dll' name 'ImmGetHotKey';result := DllCall("IMM32\ImmGetHotKey"
, "UInt", param0 ; DWORD
, "Ptr", lpuModifiers ; DWORD* out
, "Ptr", lpuVKey ; DWORD* out
, "Ptr", phKL ; HKL* out
, "Int") ; return: BOOL●ImmGetHotKey(param0, lpuModifiers, lpuVKey, phKL) = DLL("IMM32.dll", "bool ImmGetHotKey(dword, void*, void*, void*)")
# 呼び出し: ImmGetHotKey(param0, lpuModifiers, lpuVKey, phKL)
# param0 : DWORD -> "dword"
# lpuModifiers : DWORD* out -> "void*"
# lpuVKey : DWORD* out -> "void*"
# phKL : HKL* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。