Win32 API 日本語リファレンス
ホームUI.Shell › DragQueryPoint

DragQueryPoint

関数
ファイルがドロップされた位置の座標を取得する。
DLLSHELL32.dll呼出規約winapi対応OSWindows XP 以降

シグネチャ

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

BOOL DragQueryPoint(
    HDROP hDrop,
    POINT* ppt
);

パラメーター

名前方向
hDropHDROPin
pptPOINT*out

戻り値の型: BOOL

各言語での呼び出し定義

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

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

DragQueryPoint = ctypes.windll.shell32.DragQueryPoint
DragQueryPoint.restype = wintypes.BOOL
DragQueryPoint.argtypes = [
    wintypes.HANDLE,  # hDrop : HDROP
    ctypes.c_void_p,  # ppt : POINT* out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	shell32 = windows.NewLazySystemDLL("SHELL32.dll")
	procDragQueryPoint = shell32.NewProc("DragQueryPoint")
)

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