Win32 API 日本語リファレンス
ホームSystem.EventCollector › EcInsertObjectArrayElement

EcInsertObjectArrayElement

関数
オブジェクト配列に新しい要素を挿入する。
DLLWecApi.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

BOOL EcInsertObjectArrayElement(
    INT_PTR ObjectArray,
    DWORD ArrayIndex
);

パラメーター

名前方向
ObjectArrayINT_PTRin
ArrayIndexDWORDin

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL EcInsertObjectArrayElement(
    INT_PTR ObjectArray,
    DWORD ArrayIndex
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("WecApi.dll", ExactSpelling = true)]
static extern bool EcInsertObjectArrayElement(
    IntPtr ObjectArray,   // INT_PTR
    uint ArrayIndex   // DWORD
);
<DllImport("WecApi.dll", ExactSpelling:=True)>
Public Shared Function EcInsertObjectArrayElement(
    ObjectArray As IntPtr,   ' INT_PTR
    ArrayIndex As UInteger   ' DWORD
) As Boolean
End Function
' ObjectArray : INT_PTR
' ArrayIndex : DWORD
Declare PtrSafe Function EcInsertObjectArrayElement Lib "wecapi" ( _
    ByVal ObjectArray As LongPtr, _
    ByVal ArrayIndex As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

EcInsertObjectArrayElement = ctypes.windll.wecapi.EcInsertObjectArrayElement
EcInsertObjectArrayElement.restype = wintypes.BOOL
EcInsertObjectArrayElement.argtypes = [
    ctypes.c_ssize_t,  # ObjectArray : INT_PTR
    wintypes.DWORD,  # ArrayIndex : DWORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('WecApi.dll')
EcInsertObjectArrayElement = Fiddle::Function.new(
  lib['EcInsertObjectArrayElement'],
  [
    Fiddle::TYPE_INTPTR_T,  # ObjectArray : INT_PTR
    -Fiddle::TYPE_INT,  # ArrayIndex : DWORD
  ],
  Fiddle::TYPE_INT)
#[link(name = "wecapi")]
extern "system" {
    fn EcInsertObjectArrayElement(
        ObjectArray: isize,  // INT_PTR
        ArrayIndex: u32  // DWORD
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("WecApi.dll")]
public static extern bool EcInsertObjectArrayElement(IntPtr ObjectArray, uint ArrayIndex);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WecApi_EcInsertObjectArrayElement' -Namespace Win32 -PassThru
# $api::EcInsertObjectArrayElement(ObjectArray, ArrayIndex)
#uselib "WecApi.dll"
#func global EcInsertObjectArrayElement "EcInsertObjectArrayElement" sptr, sptr
; EcInsertObjectArrayElement ObjectArray, ArrayIndex   ; 戻り値は stat
; ObjectArray : INT_PTR -> "sptr"
; ArrayIndex : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "WecApi.dll"
#cfunc global EcInsertObjectArrayElement "EcInsertObjectArrayElement" sptr, int
; res = EcInsertObjectArrayElement(ObjectArray, ArrayIndex)
; ObjectArray : INT_PTR -> "sptr"
; ArrayIndex : DWORD -> "int"
; BOOL EcInsertObjectArrayElement(INT_PTR ObjectArray, DWORD ArrayIndex)
#uselib "WecApi.dll"
#cfunc global EcInsertObjectArrayElement "EcInsertObjectArrayElement" intptr, int
; res = EcInsertObjectArrayElement(ObjectArray, ArrayIndex)
; ObjectArray : INT_PTR -> "intptr"
; ArrayIndex : DWORD -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	wecapi = windows.NewLazySystemDLL("WecApi.dll")
	procEcInsertObjectArrayElement = wecapi.NewProc("EcInsertObjectArrayElement")
)

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