ホーム › System.Ole › IsAccelerator
IsAccelerator
関数メッセージがアクセラレータテーブルに該当するか判定する。
シグネチャ
// OLE32.dll
#include <windows.h>
BOOL IsAccelerator(
HACCEL hAccel,
INT cAccelEntries,
MSG* lpMsg,
WORD* lpwCmd
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hAccel | HACCEL | in |
| cAccelEntries | INT | in |
| lpMsg | MSG* | in |
| lpwCmd | WORD* | out |
戻り値の型: BOOL
各言語での呼び出し定義
// OLE32.dll
#include <windows.h>
BOOL IsAccelerator(
HACCEL hAccel,
INT cAccelEntries,
MSG* lpMsg,
WORD* lpwCmd
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("OLE32.dll", ExactSpelling = true)]
static extern bool IsAccelerator(
IntPtr hAccel, // HACCEL
int cAccelEntries, // INT
IntPtr lpMsg, // MSG*
out ushort lpwCmd // WORD* out
);<DllImport("OLE32.dll", ExactSpelling:=True)>
Public Shared Function IsAccelerator(
hAccel As IntPtr, ' HACCEL
cAccelEntries As Integer, ' INT
lpMsg As IntPtr, ' MSG*
<Out> ByRef lpwCmd As UShort ' WORD* out
) As Boolean
End Function' hAccel : HACCEL
' cAccelEntries : INT
' lpMsg : MSG*
' lpwCmd : WORD* out
Declare PtrSafe Function IsAccelerator Lib "ole32" ( _
ByVal hAccel As LongPtr, _
ByVal cAccelEntries As Long, _
ByVal lpMsg As LongPtr, _
ByRef lpwCmd As Integer) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
IsAccelerator = ctypes.windll.ole32.IsAccelerator
IsAccelerator.restype = wintypes.BOOL
IsAccelerator.argtypes = [
wintypes.HANDLE, # hAccel : HACCEL
ctypes.c_int, # cAccelEntries : INT
ctypes.c_void_p, # lpMsg : MSG*
ctypes.POINTER(ctypes.c_ushort), # lpwCmd : WORD* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('OLE32.dll')
IsAccelerator = Fiddle::Function.new(
lib['IsAccelerator'],
[
Fiddle::TYPE_VOIDP, # hAccel : HACCEL
Fiddle::TYPE_INT, # cAccelEntries : INT
Fiddle::TYPE_VOIDP, # lpMsg : MSG*
Fiddle::TYPE_VOIDP, # lpwCmd : WORD* out
],
Fiddle::TYPE_INT)#[link(name = "ole32")]
extern "system" {
fn IsAccelerator(
hAccel: *mut core::ffi::c_void, // HACCEL
cAccelEntries: i32, // INT
lpMsg: *mut MSG, // MSG*
lpwCmd: *mut u16 // WORD* out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("OLE32.dll")]
public static extern bool IsAccelerator(IntPtr hAccel, int cAccelEntries, IntPtr lpMsg, out ushort lpwCmd);
"@
$api = Add-Type -MemberDefinition $sig -Name 'OLE32_IsAccelerator' -Namespace Win32 -PassThru
# $api::IsAccelerator(hAccel, cAccelEntries, lpMsg, lpwCmd)#uselib "OLE32.dll"
#func global IsAccelerator "IsAccelerator" sptr, sptr, sptr, sptr
; IsAccelerator hAccel, cAccelEntries, varptr(lpMsg), varptr(lpwCmd) ; 戻り値は stat
; hAccel : HACCEL -> "sptr"
; cAccelEntries : INT -> "sptr"
; lpMsg : MSG* -> "sptr"
; lpwCmd : WORD* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "OLE32.dll" #cfunc global IsAccelerator "IsAccelerator" sptr, int, var, var ; res = IsAccelerator(hAccel, cAccelEntries, lpMsg, lpwCmd) ; hAccel : HACCEL -> "sptr" ; cAccelEntries : INT -> "int" ; lpMsg : MSG* -> "var" ; lpwCmd : WORD* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "OLE32.dll" #cfunc global IsAccelerator "IsAccelerator" sptr, int, sptr, sptr ; res = IsAccelerator(hAccel, cAccelEntries, varptr(lpMsg), varptr(lpwCmd)) ; hAccel : HACCEL -> "sptr" ; cAccelEntries : INT -> "int" ; lpMsg : MSG* -> "sptr" ; lpwCmd : WORD* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL IsAccelerator(HACCEL hAccel, INT cAccelEntries, MSG* lpMsg, WORD* lpwCmd) #uselib "OLE32.dll" #cfunc global IsAccelerator "IsAccelerator" intptr, int, var, var ; res = IsAccelerator(hAccel, cAccelEntries, lpMsg, lpwCmd) ; hAccel : HACCEL -> "intptr" ; cAccelEntries : INT -> "int" ; lpMsg : MSG* -> "var" ; lpwCmd : WORD* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL IsAccelerator(HACCEL hAccel, INT cAccelEntries, MSG* lpMsg, WORD* lpwCmd) #uselib "OLE32.dll" #cfunc global IsAccelerator "IsAccelerator" intptr, int, intptr, intptr ; res = IsAccelerator(hAccel, cAccelEntries, varptr(lpMsg), varptr(lpwCmd)) ; hAccel : HACCEL -> "intptr" ; cAccelEntries : INT -> "int" ; lpMsg : MSG* -> "intptr" ; lpwCmd : WORD* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
ole32 = windows.NewLazySystemDLL("OLE32.dll")
procIsAccelerator = ole32.NewProc("IsAccelerator")
)
// hAccel (HACCEL), cAccelEntries (INT), lpMsg (MSG*), lpwCmd (WORD* out)
r1, _, err := procIsAccelerator.Call(
uintptr(hAccel),
uintptr(cAccelEntries),
uintptr(lpMsg),
uintptr(lpwCmd),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction IsAccelerator(
hAccel: THandle; // HACCEL
cAccelEntries: Integer; // INT
lpMsg: Pointer; // MSG*
lpwCmd: Pointer // WORD* out
): BOOL; stdcall;
external 'OLE32.dll' name 'IsAccelerator';result := DllCall("OLE32\IsAccelerator"
, "Ptr", hAccel ; HACCEL
, "Int", cAccelEntries ; INT
, "Ptr", lpMsg ; MSG*
, "Ptr", lpwCmd ; WORD* out
, "Int") ; return: BOOL●IsAccelerator(hAccel, cAccelEntries, lpMsg, lpwCmd) = DLL("OLE32.dll", "bool IsAccelerator(void*, int, void*, void*)")
# 呼び出し: IsAccelerator(hAccel, cAccelEntries, lpMsg, lpwCmd)
# hAccel : HACCEL -> "void*"
# cAccelEntries : INT -> "int"
# lpMsg : MSG* -> "void*"
# lpwCmd : WORD* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。