ホーム › UI.Input.KeyboardAndMouse › DragDetect
DragDetect
関数ユーザーがドラッグ操作を開始したかを検出する。
シグネチャ
// USER32.dll
#include <windows.h>
BOOL DragDetect(
HWND hwnd,
POINT pt
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hwnd | HWND | in |
| pt | POINT | in |
戻り値の型: BOOL
各言語での呼び出し定義
// USER32.dll
#include <windows.h>
BOOL DragDetect(
HWND hwnd,
POINT pt
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("USER32.dll", ExactSpelling = true)]
static extern bool DragDetect(
IntPtr hwnd, // HWND
POINT pt // POINT
);<DllImport("USER32.dll", ExactSpelling:=True)>
Public Shared Function DragDetect(
hwnd As IntPtr, ' HWND
pt As POINT ' POINT
) As Boolean
End Function' hwnd : HWND
' pt : POINT
Declare PtrSafe Function DragDetect Lib "user32" ( _
ByVal hwnd As LongPtr, _
ByVal pt As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
DragDetect = ctypes.windll.user32.DragDetect
DragDetect.restype = wintypes.BOOL
DragDetect.argtypes = [
wintypes.HANDLE, # hwnd : HWND
POINT, # pt : POINT
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('USER32.dll')
DragDetect = Fiddle::Function.new(
lib['DragDetect'],
[
Fiddle::TYPE_VOIDP, # hwnd : HWND
Fiddle::TYPE_VOIDP, # pt : POINT
],
Fiddle::TYPE_INT)#[link(name = "user32")]
extern "system" {
fn DragDetect(
hwnd: *mut core::ffi::c_void, // HWND
pt: POINT // POINT
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("USER32.dll")]
public static extern bool DragDetect(IntPtr hwnd, POINT pt);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USER32_DragDetect' -Namespace Win32 -PassThru
# $api::DragDetect(hwnd, pt)#uselib "USER32.dll"
#func global DragDetect "DragDetect" sptr, sptr
; DragDetect hwnd, pt ; 戻り値は stat
; hwnd : HWND -> "sptr"
; pt : POINT -> "sptr"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "USER32.dll"
#cfunc global DragDetect "DragDetect" sptr, int
; res = DragDetect(hwnd, pt)
; hwnd : HWND -> "sptr"
; pt : POINT -> "int"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。; BOOL DragDetect(HWND hwnd, POINT pt)
#uselib "USER32.dll"
#cfunc global DragDetect "DragDetect" intptr, int
; res = DragDetect(hwnd, pt)
; hwnd : HWND -> "intptr"
; pt : POINT -> "int"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
user32 = windows.NewLazySystemDLL("USER32.dll")
procDragDetect = user32.NewProc("DragDetect")
)
// hwnd (HWND), pt (POINT)
r1, _, err := procDragDetect.Call(
uintptr(hwnd),
uintptr(pt),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction DragDetect(
hwnd: THandle; // HWND
pt: POINT // POINT
): BOOL; stdcall;
external 'USER32.dll' name 'DragDetect';result := DllCall("USER32\DragDetect"
, "Ptr", hwnd ; HWND
, "Ptr", pt ; POINT
, "Int") ; return: BOOL●DragDetect(hwnd, pt) = DLL("USER32.dll", "bool DragDetect(void*, void*)")
# 呼び出し: DragDetect(hwnd, pt)
# hwnd : HWND -> "void*"
# pt : POINT -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。