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

DPA_GetPtr

関数
動的ポインタ配列の指定位置のポインタを取得する。
DLLCOMCTL32.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

void* DPA_GetPtr(
    HDPA hdpa,
    INT_PTR i
);

パラメーター

名前方向
hdpaHDPAin
iINT_PTRin

戻り値の型: void*

各言語での呼び出し定義

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

void* DPA_GetPtr(
    HDPA hdpa,
    INT_PTR i
);
[DllImport("COMCTL32.dll", ExactSpelling = true)]
static extern IntPtr DPA_GetPtr(
    IntPtr hdpa,   // HDPA
    IntPtr i   // INT_PTR
);
<DllImport("COMCTL32.dll", ExactSpelling:=True)>
Public Shared Function DPA_GetPtr(
    hdpa As IntPtr,   ' HDPA
    i As IntPtr   ' INT_PTR
) As IntPtr
End Function
' hdpa : HDPA
' i : INT_PTR
Declare PtrSafe Function DPA_GetPtr Lib "comctl32" ( _
    ByVal hdpa As LongPtr, _
    ByVal i As LongPtr) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

DPA_GetPtr = ctypes.windll.comctl32.DPA_GetPtr
DPA_GetPtr.restype = ctypes.c_void_p
DPA_GetPtr.argtypes = [
    ctypes.c_ssize_t,  # hdpa : HDPA
    ctypes.c_ssize_t,  # i : INT_PTR
]
require 'fiddle'
require 'fiddle/import'

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

var (
	comctl32 = windows.NewLazySystemDLL("COMCTL32.dll")
	procDPA_GetPtr = comctl32.NewProc("DPA_GetPtr")
)

// hdpa (HDPA), i (INT_PTR)
r1, _, err := procDPA_GetPtr.Call(
	uintptr(hdpa),
	uintptr(i),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // void*
function DPA_GetPtr(
  hdpa: NativeInt;   // HDPA
  i: NativeInt   // INT_PTR
): Pointer; stdcall;
  external 'COMCTL32.dll' name 'DPA_GetPtr';
result := DllCall("COMCTL32\DPA_GetPtr"
    , "Ptr", hdpa   ; HDPA
    , "Ptr", i   ; INT_PTR
    , "Ptr")   ; return: void*
●DPA_GetPtr(hdpa, i) = DLL("COMCTL32.dll", "void* DPA_GetPtr(int, int)")
# 呼び出し: DPA_GetPtr(hdpa, i)
# hdpa : HDPA -> "int"
# i : INT_PTR -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。