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