ホーム › UI.Input.Touch › RegisterTouchWindow
RegisterTouchWindow
関数指定ウィンドウをタッチ入力対応として登録する。
シグネチャ
// USER32.dll
#include <windows.h>
BOOL RegisterTouchWindow(
HWND hwnd,
REGISTER_TOUCH_WINDOW_FLAGS ulFlags
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hwnd | HWND | in |
| ulFlags | REGISTER_TOUCH_WINDOW_FLAGS | in |
戻り値の型: BOOL
各言語での呼び出し定義
// USER32.dll
#include <windows.h>
BOOL RegisterTouchWindow(
HWND hwnd,
REGISTER_TOUCH_WINDOW_FLAGS ulFlags
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("USER32.dll", SetLastError = true, ExactSpelling = true)]
static extern bool RegisterTouchWindow(
IntPtr hwnd, // HWND
uint ulFlags // REGISTER_TOUCH_WINDOW_FLAGS
);<DllImport("USER32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function RegisterTouchWindow(
hwnd As IntPtr, ' HWND
ulFlags As UInteger ' REGISTER_TOUCH_WINDOW_FLAGS
) As Boolean
End Function' hwnd : HWND
' ulFlags : REGISTER_TOUCH_WINDOW_FLAGS
Declare PtrSafe Function RegisterTouchWindow Lib "user32" ( _
ByVal hwnd As LongPtr, _
ByVal ulFlags As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
RegisterTouchWindow = ctypes.windll.user32.RegisterTouchWindow
RegisterTouchWindow.restype = wintypes.BOOL
RegisterTouchWindow.argtypes = [
wintypes.HANDLE, # hwnd : HWND
wintypes.DWORD, # ulFlags : REGISTER_TOUCH_WINDOW_FLAGS
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('USER32.dll')
RegisterTouchWindow = Fiddle::Function.new(
lib['RegisterTouchWindow'],
[
Fiddle::TYPE_VOIDP, # hwnd : HWND
-Fiddle::TYPE_INT, # ulFlags : REGISTER_TOUCH_WINDOW_FLAGS
],
Fiddle::TYPE_INT)#[link(name = "user32")]
extern "system" {
fn RegisterTouchWindow(
hwnd: *mut core::ffi::c_void, // HWND
ulFlags: u32 // REGISTER_TOUCH_WINDOW_FLAGS
) -> 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 RegisterTouchWindow(IntPtr hwnd, uint ulFlags);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USER32_RegisterTouchWindow' -Namespace Win32 -PassThru
# $api::RegisterTouchWindow(hwnd, ulFlags)#uselib "USER32.dll"
#func global RegisterTouchWindow "RegisterTouchWindow" sptr, sptr
; RegisterTouchWindow hwnd, ulFlags ; 戻り値は stat
; hwnd : HWND -> "sptr"
; ulFlags : REGISTER_TOUCH_WINDOW_FLAGS -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "USER32.dll"
#cfunc global RegisterTouchWindow "RegisterTouchWindow" sptr, int
; res = RegisterTouchWindow(hwnd, ulFlags)
; hwnd : HWND -> "sptr"
; ulFlags : REGISTER_TOUCH_WINDOW_FLAGS -> "int"; BOOL RegisterTouchWindow(HWND hwnd, REGISTER_TOUCH_WINDOW_FLAGS ulFlags)
#uselib "USER32.dll"
#cfunc global RegisterTouchWindow "RegisterTouchWindow" intptr, int
; res = RegisterTouchWindow(hwnd, ulFlags)
; hwnd : HWND -> "intptr"
; ulFlags : REGISTER_TOUCH_WINDOW_FLAGS -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
user32 = windows.NewLazySystemDLL("USER32.dll")
procRegisterTouchWindow = user32.NewProc("RegisterTouchWindow")
)
// hwnd (HWND), ulFlags (REGISTER_TOUCH_WINDOW_FLAGS)
r1, _, err := procRegisterTouchWindow.Call(
uintptr(hwnd),
uintptr(ulFlags),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction RegisterTouchWindow(
hwnd: THandle; // HWND
ulFlags: DWORD // REGISTER_TOUCH_WINDOW_FLAGS
): BOOL; stdcall;
external 'USER32.dll' name 'RegisterTouchWindow';result := DllCall("USER32\RegisterTouchWindow"
, "Ptr", hwnd ; HWND
, "UInt", ulFlags ; REGISTER_TOUCH_WINDOW_FLAGS
, "Int") ; return: BOOL●RegisterTouchWindow(hwnd, ulFlags) = DLL("USER32.dll", "bool RegisterTouchWindow(void*, dword)")
# 呼び出し: RegisterTouchWindow(hwnd, ulFlags)
# hwnd : HWND -> "void*"
# ulFlags : REGISTER_TOUCH_WINDOW_FLAGS -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。