ホーム › UI.Input.Touch › GetGestureConfig
GetGestureConfig
関数ウィンドウのジェスチャ構成設定を取得する。
シグネチャ
// USER32.dll
#include <windows.h>
BOOL GetGestureConfig(
HWND hwnd,
DWORD dwReserved,
DWORD dwFlags,
DWORD* pcIDs,
GESTURECONFIG* pGestureConfig,
DWORD cbSize
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hwnd | HWND | in | ジェスチャ設定を取得するウィンドウのハンドルを指定する。 |
| dwReserved | DWORD | in | 予約済み。0を指定する。 |
| dwFlags | DWORD | in | 取得対象を示すフラグ(GCF_INCLUDE_ANCESTORS等)を指定する。 |
| pcIDs | DWORD* | in | 入力時は配列容量、出力時は取得した設定数を表すDWORDへのポインタ。 |
| pGestureConfig | GESTURECONFIG* | inout | 取得したジェスチャ設定を受け取るGESTURECONFIG配列へのポインタ。 |
| cbSize | DWORD | in | GESTURECONFIG構造体1個のバイトサイズを指定する。 |
戻り値の型: BOOL
各言語での呼び出し定義
// USER32.dll
#include <windows.h>
BOOL GetGestureConfig(
HWND hwnd,
DWORD dwReserved,
DWORD dwFlags,
DWORD* pcIDs,
GESTURECONFIG* pGestureConfig,
DWORD cbSize
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("USER32.dll", SetLastError = true, ExactSpelling = true)]
static extern bool GetGestureConfig(
IntPtr hwnd, // HWND
uint dwReserved, // DWORD
uint dwFlags, // DWORD
ref uint pcIDs, // DWORD*
IntPtr pGestureConfig, // GESTURECONFIG* in/out
uint cbSize // DWORD
);<DllImport("USER32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function GetGestureConfig(
hwnd As IntPtr, ' HWND
dwReserved As UInteger, ' DWORD
dwFlags As UInteger, ' DWORD
ByRef pcIDs As UInteger, ' DWORD*
pGestureConfig As IntPtr, ' GESTURECONFIG* in/out
cbSize As UInteger ' DWORD
) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function' hwnd : HWND
' dwReserved : DWORD
' dwFlags : DWORD
' pcIDs : DWORD*
' pGestureConfig : GESTURECONFIG* in/out
' cbSize : DWORD
Declare PtrSafe Function GetGestureConfig Lib "user32" ( _
ByVal hwnd As LongPtr, _
ByVal dwReserved As Long, _
ByVal dwFlags As Long, _
ByRef pcIDs As Long, _
ByVal pGestureConfig As LongPtr, _
ByVal cbSize As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
GetGestureConfig = ctypes.windll.user32.GetGestureConfig
GetGestureConfig.restype = wintypes.BOOL
GetGestureConfig.argtypes = [
wintypes.HANDLE, # hwnd : HWND
wintypes.DWORD, # dwReserved : DWORD
wintypes.DWORD, # dwFlags : DWORD
ctypes.POINTER(wintypes.DWORD), # pcIDs : DWORD*
ctypes.c_void_p, # pGestureConfig : GESTURECONFIG* in/out
wintypes.DWORD, # cbSize : DWORD
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('USER32.dll')
GetGestureConfig = Fiddle::Function.new(
lib['GetGestureConfig'],
[
Fiddle::TYPE_VOIDP, # hwnd : HWND
-Fiddle::TYPE_INT, # dwReserved : DWORD
-Fiddle::TYPE_INT, # dwFlags : DWORD
Fiddle::TYPE_VOIDP, # pcIDs : DWORD*
Fiddle::TYPE_VOIDP, # pGestureConfig : GESTURECONFIG* in/out
-Fiddle::TYPE_INT, # cbSize : DWORD
],
Fiddle::TYPE_INT)#[link(name = "user32")]
extern "system" {
fn GetGestureConfig(
hwnd: *mut core::ffi::c_void, // HWND
dwReserved: u32, // DWORD
dwFlags: u32, // DWORD
pcIDs: *mut u32, // DWORD*
pGestureConfig: *mut GESTURECONFIG, // GESTURECONFIG* in/out
cbSize: u32 // DWORD
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("USER32.dll", SetLastError = true)]
public static extern bool GetGestureConfig(IntPtr hwnd, uint dwReserved, uint dwFlags, ref uint pcIDs, IntPtr pGestureConfig, uint cbSize);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USER32_GetGestureConfig' -Namespace Win32 -PassThru
# $api::GetGestureConfig(hwnd, dwReserved, dwFlags, pcIDs, pGestureConfig, cbSize)#uselib "USER32.dll"
#func global GetGestureConfig "GetGestureConfig" sptr, sptr, sptr, sptr, sptr, sptr
; GetGestureConfig hwnd, dwReserved, dwFlags, varptr(pcIDs), varptr(pGestureConfig), cbSize ; 戻り値は stat
; hwnd : HWND -> "sptr"
; dwReserved : DWORD -> "sptr"
; dwFlags : DWORD -> "sptr"
; pcIDs : DWORD* -> "sptr"
; pGestureConfig : GESTURECONFIG* in/out -> "sptr"
; cbSize : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "USER32.dll" #cfunc global GetGestureConfig "GetGestureConfig" sptr, int, int, var, var, int ; res = GetGestureConfig(hwnd, dwReserved, dwFlags, pcIDs, pGestureConfig, cbSize) ; hwnd : HWND -> "sptr" ; dwReserved : DWORD -> "int" ; dwFlags : DWORD -> "int" ; pcIDs : DWORD* -> "var" ; pGestureConfig : GESTURECONFIG* in/out -> "var" ; cbSize : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "USER32.dll" #cfunc global GetGestureConfig "GetGestureConfig" sptr, int, int, sptr, sptr, int ; res = GetGestureConfig(hwnd, dwReserved, dwFlags, varptr(pcIDs), varptr(pGestureConfig), cbSize) ; hwnd : HWND -> "sptr" ; dwReserved : DWORD -> "int" ; dwFlags : DWORD -> "int" ; pcIDs : DWORD* -> "sptr" ; pGestureConfig : GESTURECONFIG* in/out -> "sptr" ; cbSize : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL GetGestureConfig(HWND hwnd, DWORD dwReserved, DWORD dwFlags, DWORD* pcIDs, GESTURECONFIG* pGestureConfig, DWORD cbSize) #uselib "USER32.dll" #cfunc global GetGestureConfig "GetGestureConfig" intptr, int, int, var, var, int ; res = GetGestureConfig(hwnd, dwReserved, dwFlags, pcIDs, pGestureConfig, cbSize) ; hwnd : HWND -> "intptr" ; dwReserved : DWORD -> "int" ; dwFlags : DWORD -> "int" ; pcIDs : DWORD* -> "var" ; pGestureConfig : GESTURECONFIG* in/out -> "var" ; cbSize : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL GetGestureConfig(HWND hwnd, DWORD dwReserved, DWORD dwFlags, DWORD* pcIDs, GESTURECONFIG* pGestureConfig, DWORD cbSize) #uselib "USER32.dll" #cfunc global GetGestureConfig "GetGestureConfig" intptr, int, int, intptr, intptr, int ; res = GetGestureConfig(hwnd, dwReserved, dwFlags, varptr(pcIDs), varptr(pGestureConfig), cbSize) ; hwnd : HWND -> "intptr" ; dwReserved : DWORD -> "int" ; dwFlags : DWORD -> "int" ; pcIDs : DWORD* -> "intptr" ; pGestureConfig : GESTURECONFIG* in/out -> "intptr" ; cbSize : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
user32 = windows.NewLazySystemDLL("USER32.dll")
procGetGestureConfig = user32.NewProc("GetGestureConfig")
)
// hwnd (HWND), dwReserved (DWORD), dwFlags (DWORD), pcIDs (DWORD*), pGestureConfig (GESTURECONFIG* in/out), cbSize (DWORD)
r1, _, err := procGetGestureConfig.Call(
uintptr(hwnd),
uintptr(dwReserved),
uintptr(dwFlags),
uintptr(pcIDs),
uintptr(pGestureConfig),
uintptr(cbSize),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction GetGestureConfig(
hwnd: THandle; // HWND
dwReserved: DWORD; // DWORD
dwFlags: DWORD; // DWORD
pcIDs: Pointer; // DWORD*
pGestureConfig: Pointer; // GESTURECONFIG* in/out
cbSize: DWORD // DWORD
): BOOL; stdcall;
external 'USER32.dll' name 'GetGestureConfig';result := DllCall("USER32\GetGestureConfig"
, "Ptr", hwnd ; HWND
, "UInt", dwReserved ; DWORD
, "UInt", dwFlags ; DWORD
, "Ptr", pcIDs ; DWORD*
, "Ptr", pGestureConfig ; GESTURECONFIG* in/out
, "UInt", cbSize ; DWORD
, "Int") ; return: BOOL●GetGestureConfig(hwnd, dwReserved, dwFlags, pcIDs, pGestureConfig, cbSize) = DLL("USER32.dll", "bool GetGestureConfig(void*, dword, dword, void*, void*, dword)")
# 呼び出し: GetGestureConfig(hwnd, dwReserved, dwFlags, pcIDs, pGestureConfig, cbSize)
# hwnd : HWND -> "void*"
# dwReserved : DWORD -> "dword"
# dwFlags : DWORD -> "dword"
# pcIDs : DWORD* -> "void*"
# pGestureConfig : GESTURECONFIG* in/out -> "void*"
# cbSize : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "user32" fn GetGestureConfig(
hwnd: ?*anyopaque, // HWND
dwReserved: u32, // DWORD
dwFlags: u32, // DWORD
pcIDs: [*c]u32, // DWORD*
pGestureConfig: [*c]GESTURECONFIG, // GESTURECONFIG* in/out
cbSize: u32 // DWORD
) callconv(std.os.windows.WINAPI) i32;proc GetGestureConfig(
hwnd: pointer, # HWND
dwReserved: uint32, # DWORD
dwFlags: uint32, # DWORD
pcIDs: ptr uint32, # DWORD*
pGestureConfig: ptr GESTURECONFIG, # GESTURECONFIG* in/out
cbSize: uint32 # DWORD
): int32 {.importc: "GetGestureConfig", stdcall, dynlib: "USER32.dll".}pragma(lib, "user32");
extern(Windows)
int GetGestureConfig(
void* hwnd, // HWND
uint dwReserved, // DWORD
uint dwFlags, // DWORD
uint* pcIDs, // DWORD*
GESTURECONFIG* pGestureConfig, // GESTURECONFIG* in/out
uint cbSize // DWORD
);ccall((:GetGestureConfig, "USER32.dll"), stdcall, Int32,
(Ptr{Cvoid}, UInt32, UInt32, Ptr{UInt32}, Ptr{GESTURECONFIG}, UInt32),
hwnd, dwReserved, dwFlags, pcIDs, pGestureConfig, cbSize)
# hwnd : HWND -> Ptr{Cvoid}
# dwReserved : DWORD -> UInt32
# dwFlags : DWORD -> UInt32
# pcIDs : DWORD* -> Ptr{UInt32}
# pGestureConfig : GESTURECONFIG* in/out -> Ptr{GESTURECONFIG}
# cbSize : DWORD -> UInt32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t GetGestureConfig(
void* hwnd,
uint32_t dwReserved,
uint32_t dwFlags,
uint32_t* pcIDs,
void* pGestureConfig,
uint32_t cbSize);
]]
local user32 = ffi.load("user32")
-- user32.GetGestureConfig(hwnd, dwReserved, dwFlags, pcIDs, pGestureConfig, cbSize)
-- hwnd : HWND
-- dwReserved : DWORD
-- dwFlags : DWORD
-- pcIDs : DWORD*
-- pGestureConfig : GESTURECONFIG* in/out
-- cbSize : DWORD
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('USER32.dll');
const GetGestureConfig = lib.func('__stdcall', 'GetGestureConfig', 'int32_t', ['void *', 'uint32_t', 'uint32_t', 'uint32_t *', 'void *', 'uint32_t']);
// GetGestureConfig(hwnd, dwReserved, dwFlags, pcIDs, pGestureConfig, cbSize)
// hwnd : HWND -> 'void *'
// dwReserved : DWORD -> 'uint32_t'
// dwFlags : DWORD -> 'uint32_t'
// pcIDs : DWORD* -> 'uint32_t *'
// pGestureConfig : GESTURECONFIG* in/out -> 'void *'
// cbSize : DWORD -> 'uint32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("USER32.dll", {
GetGestureConfig: { parameters: ["pointer", "u32", "u32", "pointer", "pointer", "u32"], result: "i32" },
});
// lib.symbols.GetGestureConfig(hwnd, dwReserved, dwFlags, pcIDs, pGestureConfig, cbSize)
// hwnd : HWND -> "pointer"
// dwReserved : DWORD -> "u32"
// dwFlags : DWORD -> "u32"
// pcIDs : DWORD* -> "pointer"
// pGestureConfig : GESTURECONFIG* in/out -> "pointer"
// cbSize : DWORD -> "u32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t GetGestureConfig(
void* hwnd,
uint32_t dwReserved,
uint32_t dwFlags,
uint32_t* pcIDs,
void* pGestureConfig,
uint32_t cbSize);
C, "USER32.dll");
// $ffi->GetGestureConfig(hwnd, dwReserved, dwFlags, pcIDs, pGestureConfig, cbSize);
// hwnd : HWND
// dwReserved : DWORD
// dwFlags : DWORD
// pcIDs : DWORD*
// pGestureConfig : GESTURECONFIG* in/out
// cbSize : DWORD
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface User32 extends StdCallLibrary {
User32 INSTANCE = Native.load("user32", User32.class);
boolean GetGestureConfig(
Pointer hwnd, // HWND
int dwReserved, // DWORD
int dwFlags, // DWORD
IntByReference pcIDs, // DWORD*
Pointer pGestureConfig, // GESTURECONFIG* in/out
int cbSize // DWORD
);
}@[Link("user32")]
lib LibUSER32
fun GetGestureConfig = GetGestureConfig(
hwnd : Void*, # HWND
dwReserved : UInt32, # DWORD
dwFlags : UInt32, # DWORD
pcIDs : UInt32*, # DWORD*
pGestureConfig : GESTURECONFIG*, # GESTURECONFIG* in/out
cbSize : UInt32 # DWORD
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef GetGestureConfigNative = Int32 Function(Pointer<Void>, Uint32, Uint32, Pointer<Uint32>, Pointer<Void>, Uint32);
typedef GetGestureConfigDart = int Function(Pointer<Void>, int, int, Pointer<Uint32>, Pointer<Void>, int);
final GetGestureConfig = DynamicLibrary.open('USER32.dll')
.lookupFunction<GetGestureConfigNative, GetGestureConfigDart>('GetGestureConfig');
// hwnd : HWND -> Pointer<Void>
// dwReserved : DWORD -> Uint32
// dwFlags : DWORD -> Uint32
// pcIDs : DWORD* -> Pointer<Uint32>
// pGestureConfig : GESTURECONFIG* in/out -> Pointer<Void>
// cbSize : DWORD -> Uint32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function GetGestureConfig(
hwnd: THandle; // HWND
dwReserved: DWORD; // DWORD
dwFlags: DWORD; // DWORD
pcIDs: Pointer; // DWORD*
pGestureConfig: Pointer; // GESTURECONFIG* in/out
cbSize: DWORD // DWORD
): BOOL; stdcall;
external 'USER32.dll' name 'GetGestureConfig';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "GetGestureConfig"
c_GetGestureConfig :: Ptr () -> Word32 -> Word32 -> Ptr Word32 -> Ptr () -> Word32 -> IO CInt
-- hwnd : HWND -> Ptr ()
-- dwReserved : DWORD -> Word32
-- dwFlags : DWORD -> Word32
-- pcIDs : DWORD* -> Ptr Word32
-- pGestureConfig : GESTURECONFIG* in/out -> Ptr ()
-- cbSize : DWORD -> Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let getgestureconfig =
foreign "GetGestureConfig"
((ptr void) @-> uint32_t @-> uint32_t @-> (ptr uint32_t) @-> (ptr void) @-> uint32_t @-> returning int32_t)
(* hwnd : HWND -> (ptr void) *)
(* dwReserved : DWORD -> uint32_t *)
(* dwFlags : DWORD -> uint32_t *)
(* pcIDs : DWORD* -> (ptr uint32_t) *)
(* pGestureConfig : GESTURECONFIG* in/out -> (ptr void) *)
(* cbSize : DWORD -> uint32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library user32 (t "USER32.dll"))
(cffi:use-foreign-library user32)
(cffi:defcfun ("GetGestureConfig" get-gesture-config :convention :stdcall) :int32
(hwnd :pointer) ; HWND
(dw-reserved :uint32) ; DWORD
(dw-flags :uint32) ; DWORD
(pc-ids :pointer) ; DWORD*
(p-gesture-config :pointer) ; GESTURECONFIG* in/out
(cb-size :uint32)) ; DWORD
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $GetGestureConfig = Win32::API::More->new('USER32',
'BOOL GetGestureConfig(HANDLE hwnd, DWORD dwReserved, DWORD dwFlags, LPVOID pcIDs, LPVOID pGestureConfig, DWORD cbSize)');
# my $ret = $GetGestureConfig->Call($hwnd, $dwReserved, $dwFlags, $pcIDs, $pGestureConfig, $cbSize);
# hwnd : HWND -> HANDLE
# dwReserved : DWORD -> DWORD
# dwFlags : DWORD -> DWORD
# pcIDs : DWORD* -> LPVOID
# pGestureConfig : GESTURECONFIG* in/out -> LPVOID
# cbSize : DWORD -> DWORD
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型