ホーム › UI.WindowsAndMessaging › DragObject
DragObject
関数オブジェクトのドラッグ操作を開始し処理する。
シグネチャ
// USER32.dll
#include <windows.h>
DWORD DragObject(
HWND hwndParent,
HWND hwndFrom,
DWORD fmt,
UINT_PTR data,
HCURSOR hcur // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hwndParent | HWND | in |
| hwndFrom | HWND | in |
| fmt | DWORD | in |
| data | UINT_PTR | in |
| hcur | HCURSOR | inoptional |
戻り値の型: DWORD
各言語での呼び出し定義
// USER32.dll
#include <windows.h>
DWORD DragObject(
HWND hwndParent,
HWND hwndFrom,
DWORD fmt,
UINT_PTR data,
HCURSOR hcur // optional
);[DllImport("USER32.dll", ExactSpelling = true)]
static extern uint DragObject(
IntPtr hwndParent, // HWND
IntPtr hwndFrom, // HWND
uint fmt, // DWORD
UIntPtr data, // UINT_PTR
IntPtr hcur // HCURSOR optional
);<DllImport("USER32.dll", ExactSpelling:=True)>
Public Shared Function DragObject(
hwndParent As IntPtr, ' HWND
hwndFrom As IntPtr, ' HWND
fmt As UInteger, ' DWORD
data As UIntPtr, ' UINT_PTR
hcur As IntPtr ' HCURSOR optional
) As UInteger
End Function' hwndParent : HWND
' hwndFrom : HWND
' fmt : DWORD
' data : UINT_PTR
' hcur : HCURSOR optional
Declare PtrSafe Function DragObject Lib "user32" ( _
ByVal hwndParent As LongPtr, _
ByVal hwndFrom As LongPtr, _
ByVal fmt As Long, _
ByVal data As LongPtr, _
ByVal hcur As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
DragObject = ctypes.windll.user32.DragObject
DragObject.restype = wintypes.DWORD
DragObject.argtypes = [
wintypes.HANDLE, # hwndParent : HWND
wintypes.HANDLE, # hwndFrom : HWND
wintypes.DWORD, # fmt : DWORD
ctypes.c_size_t, # data : UINT_PTR
wintypes.HANDLE, # hcur : HCURSOR optional
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('USER32.dll')
DragObject = Fiddle::Function.new(
lib['DragObject'],
[
Fiddle::TYPE_VOIDP, # hwndParent : HWND
Fiddle::TYPE_VOIDP, # hwndFrom : HWND
-Fiddle::TYPE_INT, # fmt : DWORD
Fiddle::TYPE_UINTPTR_T, # data : UINT_PTR
Fiddle::TYPE_VOIDP, # hcur : HCURSOR optional
],
-Fiddle::TYPE_INT)#[link(name = "user32")]
extern "system" {
fn DragObject(
hwndParent: *mut core::ffi::c_void, // HWND
hwndFrom: *mut core::ffi::c_void, // HWND
fmt: u32, // DWORD
data: usize, // UINT_PTR
hcur: *mut core::ffi::c_void // HCURSOR optional
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("USER32.dll")]
public static extern uint DragObject(IntPtr hwndParent, IntPtr hwndFrom, uint fmt, UIntPtr data, IntPtr hcur);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USER32_DragObject' -Namespace Win32 -PassThru
# $api::DragObject(hwndParent, hwndFrom, fmt, data, hcur)#uselib "USER32.dll"
#func global DragObject "DragObject" sptr, sptr, sptr, sptr, sptr
; DragObject hwndParent, hwndFrom, fmt, data, hcur ; 戻り値は stat
; hwndParent : HWND -> "sptr"
; hwndFrom : HWND -> "sptr"
; fmt : DWORD -> "sptr"
; data : UINT_PTR -> "sptr"
; hcur : HCURSOR optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "USER32.dll"
#cfunc global DragObject "DragObject" sptr, sptr, int, sptr, sptr
; res = DragObject(hwndParent, hwndFrom, fmt, data, hcur)
; hwndParent : HWND -> "sptr"
; hwndFrom : HWND -> "sptr"
; fmt : DWORD -> "int"
; data : UINT_PTR -> "sptr"
; hcur : HCURSOR optional -> "sptr"; DWORD DragObject(HWND hwndParent, HWND hwndFrom, DWORD fmt, UINT_PTR data, HCURSOR hcur)
#uselib "USER32.dll"
#cfunc global DragObject "DragObject" intptr, intptr, int, intptr, intptr
; res = DragObject(hwndParent, hwndFrom, fmt, data, hcur)
; hwndParent : HWND -> "intptr"
; hwndFrom : HWND -> "intptr"
; fmt : DWORD -> "int"
; data : UINT_PTR -> "intptr"
; hcur : HCURSOR optional -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
user32 = windows.NewLazySystemDLL("USER32.dll")
procDragObject = user32.NewProc("DragObject")
)
// hwndParent (HWND), hwndFrom (HWND), fmt (DWORD), data (UINT_PTR), hcur (HCURSOR optional)
r1, _, err := procDragObject.Call(
uintptr(hwndParent),
uintptr(hwndFrom),
uintptr(fmt),
uintptr(data),
uintptr(hcur),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction DragObject(
hwndParent: THandle; // HWND
hwndFrom: THandle; // HWND
fmt: DWORD; // DWORD
data: NativeUInt; // UINT_PTR
hcur: THandle // HCURSOR optional
): DWORD; stdcall;
external 'USER32.dll' name 'DragObject';result := DllCall("USER32\DragObject"
, "Ptr", hwndParent ; HWND
, "Ptr", hwndFrom ; HWND
, "UInt", fmt ; DWORD
, "UPtr", data ; UINT_PTR
, "Ptr", hcur ; HCURSOR optional
, "UInt") ; return: DWORD●DragObject(hwndParent, hwndFrom, fmt, data, hcur) = DLL("USER32.dll", "dword DragObject(void*, void*, dword, int, void*)")
# 呼び出し: DragObject(hwndParent, hwndFrom, fmt, data, hcur)
# hwndParent : HWND -> "void*"
# hwndFrom : HWND -> "void*"
# fmt : DWORD -> "dword"
# data : UINT_PTR -> "int"
# hcur : HCURSOR optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。