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