Win32 API 日本語リファレンス
ホームUI.Input.Touch › IsTouchWindow

IsTouchWindow

関数
ウィンドウがタッチ入力対応として登録済みか調べる。
DLLUSER32.dll呼出規約winapi対応OSWindows 7 以降

シグネチャ

// USER32.dll
#include <windows.h>

BOOL IsTouchWindow(
    HWND hwnd,
    DWORD* pulFlags   // optional
);

パラメーター

名前方向
hwndHWNDin
pulFlagsDWORD*outoptional

戻り値の型: BOOL

各言語での呼び出し定義

// USER32.dll
#include <windows.h>

BOOL IsTouchWindow(
    HWND hwnd,
    DWORD* pulFlags   // optional
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("USER32.dll", ExactSpelling = true)]
static extern bool IsTouchWindow(
    IntPtr hwnd,   // HWND
    IntPtr pulFlags   // DWORD* optional, out
);
<DllImport("USER32.dll", ExactSpelling:=True)>
Public Shared Function IsTouchWindow(
    hwnd As IntPtr,   ' HWND
    pulFlags As IntPtr   ' DWORD* optional, out
) As Boolean
End Function
' hwnd : HWND
' pulFlags : DWORD* optional, out
Declare PtrSafe Function IsTouchWindow Lib "user32" ( _
    ByVal hwnd As LongPtr, _
    ByVal pulFlags As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

IsTouchWindow = ctypes.windll.user32.IsTouchWindow
IsTouchWindow.restype = wintypes.BOOL
IsTouchWindow.argtypes = [
    wintypes.HANDLE,  # hwnd : HWND
    ctypes.POINTER(wintypes.DWORD),  # pulFlags : DWORD* optional, out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('USER32.dll')
IsTouchWindow = Fiddle::Function.new(
  lib['IsTouchWindow'],
  [
    Fiddle::TYPE_VOIDP,  # hwnd : HWND
    Fiddle::TYPE_VOIDP,  # pulFlags : DWORD* optional, out
  ],
  Fiddle::TYPE_INT)
#[link(name = "user32")]
extern "system" {
    fn IsTouchWindow(
        hwnd: *mut core::ffi::c_void,  // HWND
        pulFlags: *mut u32  // DWORD* optional, out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("USER32.dll")]
public static extern bool IsTouchWindow(IntPtr hwnd, IntPtr pulFlags);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USER32_IsTouchWindow' -Namespace Win32 -PassThru
# $api::IsTouchWindow(hwnd, pulFlags)
#uselib "USER32.dll"
#func global IsTouchWindow "IsTouchWindow" sptr, sptr
; IsTouchWindow hwnd, varptr(pulFlags)   ; 戻り値は stat
; hwnd : HWND -> "sptr"
; pulFlags : DWORD* optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "USER32.dll"
#cfunc global IsTouchWindow "IsTouchWindow" sptr, var
; res = IsTouchWindow(hwnd, pulFlags)
; hwnd : HWND -> "sptr"
; pulFlags : DWORD* optional, out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; BOOL IsTouchWindow(HWND hwnd, DWORD* pulFlags)
#uselib "USER32.dll"
#cfunc global IsTouchWindow "IsTouchWindow" intptr, var
; res = IsTouchWindow(hwnd, pulFlags)
; hwnd : HWND -> "intptr"
; pulFlags : DWORD* optional, out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	user32 = windows.NewLazySystemDLL("USER32.dll")
	procIsTouchWindow = user32.NewProc("IsTouchWindow")
)

// hwnd (HWND), pulFlags (DWORD* optional, out)
r1, _, err := procIsTouchWindow.Call(
	uintptr(hwnd),
	uintptr(pulFlags),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function IsTouchWindow(
  hwnd: THandle;   // HWND
  pulFlags: Pointer   // DWORD* optional, out
): BOOL; stdcall;
  external 'USER32.dll' name 'IsTouchWindow';
result := DllCall("USER32\IsTouchWindow"
    , "Ptr", hwnd   ; HWND
    , "Ptr", pulFlags   ; DWORD* optional, out
    , "Int")   ; return: BOOL
●IsTouchWindow(hwnd, pulFlags) = DLL("USER32.dll", "bool IsTouchWindow(void*, void*)")
# 呼び出し: IsTouchWindow(hwnd, pulFlags)
# hwnd : HWND -> "void*"
# pulFlags : DWORD* optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。