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

DSA_InsertItem

関数
動的構造体配列の指定位置に要素を挿入する。
DLLCOMCTL32.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

INT DSA_InsertItem(
    HDSA hdsa,
    INT i,
    const void* pitem
);

パラメーター

名前方向
hdsaHDSAin
iINTin
pitemvoid*in

戻り値の型: INT

各言語での呼び出し定義

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

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

DSA_InsertItem = ctypes.windll.comctl32.DSA_InsertItem
DSA_InsertItem.restype = ctypes.c_int
DSA_InsertItem.argtypes = [
    ctypes.c_ssize_t,  # hdsa : HDSA
    ctypes.c_int,  # i : INT
    ctypes.POINTER(None),  # pitem : void*
]
require 'fiddle'
require 'fiddle/import'

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

var (
	comctl32 = windows.NewLazySystemDLL("COMCTL32.dll")
	procDSA_InsertItem = comctl32.NewProc("DSA_InsertItem")
)

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