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

EcRemoveObjectArrayElement

関数
オブジェクト配列から指定要素を削除する。
DLLWecApi.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

BOOL EcRemoveObjectArrayElement(
    INT_PTR ObjectArray,
    DWORD ArrayIndex
);

パラメーター

名前方向説明
ObjectArrayINT_PTRin要素を削除する対象のオブジェクト配列ハンドル。
ArrayIndexDWORDin削除する要素の0基点インデックスを指定する。

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL EcRemoveObjectArrayElement(
    INT_PTR ObjectArray,
    DWORD ArrayIndex
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("WecApi.dll", ExactSpelling = true)]
static extern bool EcRemoveObjectArrayElement(
    IntPtr ObjectArray,   // INT_PTR
    uint ArrayIndex   // DWORD
);
<DllImport("WecApi.dll", ExactSpelling:=True)>
Public Shared Function EcRemoveObjectArrayElement(
    ObjectArray As IntPtr,   ' INT_PTR
    ArrayIndex As UInteger   ' DWORD
) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function
' ObjectArray : INT_PTR
' ArrayIndex : DWORD
Declare PtrSafe Function EcRemoveObjectArrayElement 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

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

lib = Fiddle.dlopen('WecApi.dll')
EcRemoveObjectArrayElement = Fiddle::Function.new(
  lib['EcRemoveObjectArrayElement'],
  [
    Fiddle::TYPE_INTPTR_T,  # ObjectArray : INT_PTR
    -Fiddle::TYPE_INT,  # ArrayIndex : DWORD
  ],
  Fiddle::TYPE_INT)
#[link(name = "wecapi")]
extern "system" {
    fn EcRemoveObjectArrayElement(
        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 EcRemoveObjectArrayElement(IntPtr ObjectArray, uint ArrayIndex);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WecApi_EcRemoveObjectArrayElement' -Namespace Win32 -PassThru
# $api::EcRemoveObjectArrayElement(ObjectArray, ArrayIndex)
#uselib "WecApi.dll"
#func global EcRemoveObjectArrayElement "EcRemoveObjectArrayElement" sptr, sptr
; EcRemoveObjectArrayElement ObjectArray, ArrayIndex   ; 戻り値は stat
; ObjectArray : INT_PTR -> "sptr"
; ArrayIndex : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "WecApi.dll"
#cfunc global EcRemoveObjectArrayElement "EcRemoveObjectArrayElement" sptr, int
; res = EcRemoveObjectArrayElement(ObjectArray, ArrayIndex)
; ObjectArray : INT_PTR -> "sptr"
; ArrayIndex : DWORD -> "int"
; BOOL EcRemoveObjectArrayElement(INT_PTR ObjectArray, DWORD ArrayIndex)
#uselib "WecApi.dll"
#cfunc global EcRemoveObjectArrayElement "EcRemoveObjectArrayElement" intptr, int
; res = EcRemoveObjectArrayElement(ObjectArray, ArrayIndex)
; ObjectArray : INT_PTR -> "intptr"
; ArrayIndex : DWORD -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	wecapi = windows.NewLazySystemDLL("WecApi.dll")
	procEcRemoveObjectArrayElement = wecapi.NewProc("EcRemoveObjectArrayElement")
)

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

extern "wecapi" fn EcRemoveObjectArrayElement(
    ObjectArray: isize, // INT_PTR
    ArrayIndex: u32 // DWORD
) callconv(std.os.windows.WINAPI) i32;
proc EcRemoveObjectArrayElement(
    ObjectArray: int,  # INT_PTR
    ArrayIndex: uint32  # DWORD
): int32 {.importc: "EcRemoveObjectArrayElement", stdcall, dynlib: "WecApi.dll".}
pragma(lib, "wecapi");
extern(Windows)
int EcRemoveObjectArrayElement(
    ptrdiff_t ObjectArray,   // INT_PTR
    uint ArrayIndex   // DWORD
);
ccall((:EcRemoveObjectArrayElement, "WecApi.dll"), stdcall, Int32,
      (Int, UInt32),
      ObjectArray, ArrayIndex)
# ObjectArray : INT_PTR -> Int
# ArrayIndex : DWORD -> UInt32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t EcRemoveObjectArrayElement(
    intptr_t ObjectArray,
    uint32_t ArrayIndex);
]]
local wecapi = ffi.load("wecapi")
-- wecapi.EcRemoveObjectArrayElement(ObjectArray, ArrayIndex)
-- ObjectArray : INT_PTR
-- ArrayIndex : DWORD
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('WecApi.dll');
const EcRemoveObjectArrayElement = lib.func('__stdcall', 'EcRemoveObjectArrayElement', 'int32_t', ['intptr_t', 'uint32_t']);
// EcRemoveObjectArrayElement(ObjectArray, ArrayIndex)
// ObjectArray : INT_PTR -> 'intptr_t'
// ArrayIndex : DWORD -> 'uint32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("WecApi.dll", {
  EcRemoveObjectArrayElement: { parameters: ["isize", "u32"], result: "i32" },
});
// lib.symbols.EcRemoveObjectArrayElement(ObjectArray, ArrayIndex)
// ObjectArray : INT_PTR -> "isize"
// ArrayIndex : DWORD -> "u32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t EcRemoveObjectArrayElement(
    intptr_t ObjectArray,
    uint32_t ArrayIndex);
C, "WecApi.dll");
// $ffi->EcRemoveObjectArrayElement(ObjectArray, ArrayIndex);
// ObjectArray : INT_PTR
// ArrayIndex : DWORD
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Wecapi extends StdCallLibrary {
    Wecapi INSTANCE = Native.load("wecapi", Wecapi.class);
    boolean EcRemoveObjectArrayElement(
        long ObjectArray,   // INT_PTR
        int ArrayIndex   // DWORD
    );
}
@[Link("wecapi")]
lib LibWecApi
  fun EcRemoveObjectArrayElement = EcRemoveObjectArrayElement(
    ObjectArray : LibC::SSizeT,   # INT_PTR
    ArrayIndex : UInt32   # DWORD
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef EcRemoveObjectArrayElementNative = Int32 Function(IntPtr, Uint32);
typedef EcRemoveObjectArrayElementDart = int Function(int, int);
final EcRemoveObjectArrayElement = DynamicLibrary.open('WecApi.dll')
    .lookupFunction<EcRemoveObjectArrayElementNative, EcRemoveObjectArrayElementDart>('EcRemoveObjectArrayElement');
// ObjectArray : INT_PTR -> IntPtr
// ArrayIndex : DWORD -> Uint32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function EcRemoveObjectArrayElement(
  ObjectArray: NativeInt;   // INT_PTR
  ArrayIndex: DWORD   // DWORD
): BOOL; stdcall;
  external 'WecApi.dll' name 'EcRemoveObjectArrayElement';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "EcRemoveObjectArrayElement"
  c_EcRemoveObjectArrayElement :: CIntPtr -> Word32 -> IO CInt
-- ObjectArray : INT_PTR -> CIntPtr
-- ArrayIndex : DWORD -> Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let ecremoveobjectarrayelement =
  foreign "EcRemoveObjectArrayElement"
    (intptr_t @-> uint32_t @-> returning int32_t)
(* ObjectArray : INT_PTR -> intptr_t *)
(* ArrayIndex : DWORD -> uint32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library wecapi (t "WecApi.dll"))
(cffi:use-foreign-library wecapi)

(cffi:defcfun ("EcRemoveObjectArrayElement" ec-remove-object-array-element :convention :stdcall) :int32
  (object-array :int64)   ; INT_PTR
  (array-index :uint32))   ; DWORD
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $EcRemoveObjectArrayElement = Win32::API::More->new('WecApi',
    'BOOL EcRemoveObjectArrayElement(LPARAM ObjectArray, DWORD ArrayIndex)');
# my $ret = $EcRemoveObjectArrayElement->Call($ObjectArray, $ArrayIndex);
# ObjectArray : INT_PTR -> LPARAM
# ArrayIndex : DWORD -> DWORD
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。