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

DPA_Search

関数
動的ポインタ配列から要素を検索する。
DLLCOMCTL32.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

INT DPA_Search(
    HDPA hdpa,
    void* pFind,   // optional
    INT iStart,
    PFNDACOMPARE pfnCompare,
    LPARAM lParam,
    DWORD options
);

パラメーター

名前方向
hdpaHDPAin
pFindvoid*inoptional
iStartINTin
pfnComparePFNDACOMPAREin
lParamLPARAMin
optionsDWORDin

戻り値の型: INT

各言語での呼び出し定義

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

INT DPA_Search(
    HDPA hdpa,
    void* pFind,   // optional
    INT iStart,
    PFNDACOMPARE pfnCompare,
    LPARAM lParam,
    DWORD options
);
[DllImport("COMCTL32.dll", ExactSpelling = true)]
static extern int DPA_Search(
    IntPtr hdpa,   // HDPA
    IntPtr pFind,   // void* optional
    int iStart,   // INT
    IntPtr pfnCompare,   // PFNDACOMPARE
    IntPtr lParam,   // LPARAM
    uint options   // DWORD
);
<DllImport("COMCTL32.dll", ExactSpelling:=True)>
Public Shared Function DPA_Search(
    hdpa As IntPtr,   ' HDPA
    pFind As IntPtr,   ' void* optional
    iStart As Integer,   ' INT
    pfnCompare As IntPtr,   ' PFNDACOMPARE
    lParam As IntPtr,   ' LPARAM
    options As UInteger   ' DWORD
) As Integer
End Function
' hdpa : HDPA
' pFind : void* optional
' iStart : INT
' pfnCompare : PFNDACOMPARE
' lParam : LPARAM
' options : DWORD
Declare PtrSafe Function DPA_Search Lib "comctl32" ( _
    ByVal hdpa As LongPtr, _
    ByVal pFind As LongPtr, _
    ByVal iStart As Long, _
    ByVal pfnCompare As LongPtr, _
    ByVal lParam As LongPtr, _
    ByVal options As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

DPA_Search = ctypes.windll.comctl32.DPA_Search
DPA_Search.restype = ctypes.c_int
DPA_Search.argtypes = [
    ctypes.c_ssize_t,  # hdpa : HDPA
    ctypes.POINTER(None),  # pFind : void* optional
    ctypes.c_int,  # iStart : INT
    ctypes.c_void_p,  # pfnCompare : PFNDACOMPARE
    ctypes.c_ssize_t,  # lParam : LPARAM
    wintypes.DWORD,  # options : DWORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('COMCTL32.dll')
DPA_Search = Fiddle::Function.new(
  lib['DPA_Search'],
  [
    Fiddle::TYPE_INTPTR_T,  # hdpa : HDPA
    Fiddle::TYPE_VOIDP,  # pFind : void* optional
    Fiddle::TYPE_INT,  # iStart : INT
    Fiddle::TYPE_VOIDP,  # pfnCompare : PFNDACOMPARE
    Fiddle::TYPE_INTPTR_T,  # lParam : LPARAM
    -Fiddle::TYPE_INT,  # options : DWORD
  ],
  Fiddle::TYPE_INT)
#[link(name = "comctl32")]
extern "system" {
    fn DPA_Search(
        hdpa: isize,  // HDPA
        pFind: *mut (),  // void* optional
        iStart: i32,  // INT
        pfnCompare: *const core::ffi::c_void,  // PFNDACOMPARE
        lParam: isize,  // LPARAM
        options: u32  // DWORD
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("COMCTL32.dll")]
public static extern int DPA_Search(IntPtr hdpa, IntPtr pFind, int iStart, IntPtr pfnCompare, IntPtr lParam, uint options);
"@
$api = Add-Type -MemberDefinition $sig -Name 'COMCTL32_DPA_Search' -Namespace Win32 -PassThru
# $api::DPA_Search(hdpa, pFind, iStart, pfnCompare, lParam, options)
#uselib "COMCTL32.dll"
#func global DPA_Search "DPA_Search" sptr, sptr, sptr, sptr, sptr, sptr
; DPA_Search hdpa, pFind, iStart, pfnCompare, lParam, options   ; 戻り値は stat
; hdpa : HDPA -> "sptr"
; pFind : void* optional -> "sptr"
; iStart : INT -> "sptr"
; pfnCompare : PFNDACOMPARE -> "sptr"
; lParam : LPARAM -> "sptr"
; options : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "COMCTL32.dll"
#cfunc global DPA_Search "DPA_Search" sptr, sptr, int, sptr, sptr, int
; res = DPA_Search(hdpa, pFind, iStart, pfnCompare, lParam, options)
; hdpa : HDPA -> "sptr"
; pFind : void* optional -> "sptr"
; iStart : INT -> "int"
; pfnCompare : PFNDACOMPARE -> "sptr"
; lParam : LPARAM -> "sptr"
; options : DWORD -> "int"
; INT DPA_Search(HDPA hdpa, void* pFind, INT iStart, PFNDACOMPARE pfnCompare, LPARAM lParam, DWORD options)
#uselib "COMCTL32.dll"
#cfunc global DPA_Search "DPA_Search" intptr, intptr, int, intptr, intptr, int
; res = DPA_Search(hdpa, pFind, iStart, pfnCompare, lParam, options)
; hdpa : HDPA -> "intptr"
; pFind : void* optional -> "intptr"
; iStart : INT -> "int"
; pfnCompare : PFNDACOMPARE -> "intptr"
; lParam : LPARAM -> "intptr"
; options : DWORD -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	comctl32 = windows.NewLazySystemDLL("COMCTL32.dll")
	procDPA_Search = comctl32.NewProc("DPA_Search")
)

// hdpa (HDPA), pFind (void* optional), iStart (INT), pfnCompare (PFNDACOMPARE), lParam (LPARAM), options (DWORD)
r1, _, err := procDPA_Search.Call(
	uintptr(hdpa),
	uintptr(pFind),
	uintptr(iStart),
	uintptr(pfnCompare),
	uintptr(lParam),
	uintptr(options),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // INT
function DPA_Search(
  hdpa: NativeInt;   // HDPA
  pFind: Pointer;   // void* optional
  iStart: Integer;   // INT
  pfnCompare: Pointer;   // PFNDACOMPARE
  lParam: NativeInt;   // LPARAM
  options: DWORD   // DWORD
): Integer; stdcall;
  external 'COMCTL32.dll' name 'DPA_Search';
result := DllCall("COMCTL32\DPA_Search"
    , "Ptr", hdpa   ; HDPA
    , "Ptr", pFind   ; void* optional
    , "Int", iStart   ; INT
    , "Ptr", pfnCompare   ; PFNDACOMPARE
    , "Ptr", lParam   ; LPARAM
    , "UInt", options   ; DWORD
    , "Int")   ; return: INT
●DPA_Search(hdpa, pFind, iStart, pfnCompare, lParam, options) = DLL("COMCTL32.dll", "int DPA_Search(int, void*, int, void*, int, dword)")
# 呼び出し: DPA_Search(hdpa, pFind, iStart, pfnCompare, lParam, options)
# hdpa : HDPA -> "int"
# pFind : void* optional -> "void*"
# iStart : INT -> "int"
# pfnCompare : PFNDACOMPARE -> "void*"
# lParam : LPARAM -> "int"
# options : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。