ホーム › System.Ole › RegisterDragDrop
RegisterDragDrop
関数ウィンドウをドロップ対象としてドラッグアンドドロップに登録する。
シグネチャ
// OLE32.dll
#include <windows.h>
HRESULT RegisterDragDrop(
HWND hwnd,
IDropTarget* pDropTarget
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hwnd | HWND | in |
| pDropTarget | IDropTarget* | in |
戻り値の型: HRESULT
各言語での呼び出し定義
// OLE32.dll
#include <windows.h>
HRESULT RegisterDragDrop(
HWND hwnd,
IDropTarget* pDropTarget
);[DllImport("OLE32.dll", ExactSpelling = true)]
static extern int RegisterDragDrop(
IntPtr hwnd, // HWND
IntPtr pDropTarget // IDropTarget*
);<DllImport("OLE32.dll", ExactSpelling:=True)>
Public Shared Function RegisterDragDrop(
hwnd As IntPtr, ' HWND
pDropTarget As IntPtr ' IDropTarget*
) As Integer
End Function' hwnd : HWND
' pDropTarget : IDropTarget*
Declare PtrSafe Function RegisterDragDrop Lib "ole32" ( _
ByVal hwnd As LongPtr, _
ByVal pDropTarget As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
RegisterDragDrop = ctypes.windll.ole32.RegisterDragDrop
RegisterDragDrop.restype = ctypes.c_int
RegisterDragDrop.argtypes = [
wintypes.HANDLE, # hwnd : HWND
ctypes.c_void_p, # pDropTarget : IDropTarget*
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('OLE32.dll')
RegisterDragDrop = Fiddle::Function.new(
lib['RegisterDragDrop'],
[
Fiddle::TYPE_VOIDP, # hwnd : HWND
Fiddle::TYPE_VOIDP, # pDropTarget : IDropTarget*
],
Fiddle::TYPE_INT)#[link(name = "ole32")]
extern "system" {
fn RegisterDragDrop(
hwnd: *mut core::ffi::c_void, // HWND
pDropTarget: *mut core::ffi::c_void // IDropTarget*
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("OLE32.dll")]
public static extern int RegisterDragDrop(IntPtr hwnd, IntPtr pDropTarget);
"@
$api = Add-Type -MemberDefinition $sig -Name 'OLE32_RegisterDragDrop' -Namespace Win32 -PassThru
# $api::RegisterDragDrop(hwnd, pDropTarget)#uselib "OLE32.dll"
#func global RegisterDragDrop "RegisterDragDrop" sptr, sptr
; RegisterDragDrop hwnd, pDropTarget ; 戻り値は stat
; hwnd : HWND -> "sptr"
; pDropTarget : IDropTarget* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "OLE32.dll"
#cfunc global RegisterDragDrop "RegisterDragDrop" sptr, sptr
; res = RegisterDragDrop(hwnd, pDropTarget)
; hwnd : HWND -> "sptr"
; pDropTarget : IDropTarget* -> "sptr"; HRESULT RegisterDragDrop(HWND hwnd, IDropTarget* pDropTarget)
#uselib "OLE32.dll"
#cfunc global RegisterDragDrop "RegisterDragDrop" intptr, intptr
; res = RegisterDragDrop(hwnd, pDropTarget)
; hwnd : HWND -> "intptr"
; pDropTarget : IDropTarget* -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
ole32 = windows.NewLazySystemDLL("OLE32.dll")
procRegisterDragDrop = ole32.NewProc("RegisterDragDrop")
)
// hwnd (HWND), pDropTarget (IDropTarget*)
r1, _, err := procRegisterDragDrop.Call(
uintptr(hwnd),
uintptr(pDropTarget),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction RegisterDragDrop(
hwnd: THandle; // HWND
pDropTarget: Pointer // IDropTarget*
): Integer; stdcall;
external 'OLE32.dll' name 'RegisterDragDrop';result := DllCall("OLE32\RegisterDragDrop"
, "Ptr", hwnd ; HWND
, "Ptr", pDropTarget ; IDropTarget*
, "Int") ; return: HRESULT●RegisterDragDrop(hwnd, pDropTarget) = DLL("OLE32.dll", "int RegisterDragDrop(void*, void*)")
# 呼び出し: RegisterDragDrop(hwnd, pDropTarget)
# hwnd : HWND -> "void*"
# pDropTarget : IDropTarget* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。