ホーム › UI.Controls › DPA_Grow
DPA_Grow
関数動的ポインタ配列の容量を指定数まで拡張する。
シグネチャ
// COMCTL32.dll
#include <windows.h>
BOOL DPA_Grow(
HDPA pdpa,
INT cp
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| pdpa | HDPA | in | 既存の DPA へのハンドルです。 |
| cp | INT | in | DPA に必要なポインターの数です。 |
戻り値の型: BOOL
公式ドキュメント
動的ポインター配列 (DPA) 内のポインター数を変更します。
戻り値
型: BOOL
成功した場合は TRUE を、それ以外の場合は FALSE を返します。
解説(Remarks)
cp が DPA 内に既に存在するポインター数より小さい場合、DPA は変更されません。cp が DPA 内のポインター数より大きい場合、追加されたポインターは NULL に初期化されます。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// COMCTL32.dll
#include <windows.h>
BOOL DPA_Grow(
HDPA pdpa,
INT cp
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("COMCTL32.dll", ExactSpelling = true)]
static extern bool DPA_Grow(
IntPtr pdpa, // HDPA
int cp // INT
);<DllImport("COMCTL32.dll", ExactSpelling:=True)>
Public Shared Function DPA_Grow(
pdpa As IntPtr, ' HDPA
cp As Integer ' INT
) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function' pdpa : HDPA
' cp : INT
Declare PtrSafe Function DPA_Grow Lib "comctl32" ( _
ByVal pdpa As LongPtr, _
ByVal cp As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
DPA_Grow = ctypes.windll.comctl32.DPA_Grow
DPA_Grow.restype = wintypes.BOOL
DPA_Grow.argtypes = [
ctypes.c_ssize_t, # pdpa : HDPA
ctypes.c_int, # cp : INT
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('COMCTL32.dll')
DPA_Grow = Fiddle::Function.new(
lib['DPA_Grow'],
[
Fiddle::TYPE_INTPTR_T, # pdpa : HDPA
Fiddle::TYPE_INT, # cp : INT
],
Fiddle::TYPE_INT)#[link(name = "comctl32")]
extern "system" {
fn DPA_Grow(
pdpa: isize, // HDPA
cp: i32 // INT
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("COMCTL32.dll")]
public static extern bool DPA_Grow(IntPtr pdpa, int cp);
"@
$api = Add-Type -MemberDefinition $sig -Name 'COMCTL32_DPA_Grow' -Namespace Win32 -PassThru
# $api::DPA_Grow(pdpa, cp)#uselib "COMCTL32.dll"
#func global DPA_Grow "DPA_Grow" sptr, sptr
; DPA_Grow pdpa, cp ; 戻り値は stat
; pdpa : HDPA -> "sptr"
; cp : INT -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "COMCTL32.dll"
#cfunc global DPA_Grow "DPA_Grow" sptr, int
; res = DPA_Grow(pdpa, cp)
; pdpa : HDPA -> "sptr"
; cp : INT -> "int"; BOOL DPA_Grow(HDPA pdpa, INT cp)
#uselib "COMCTL32.dll"
#cfunc global DPA_Grow "DPA_Grow" intptr, int
; res = DPA_Grow(pdpa, cp)
; pdpa : HDPA -> "intptr"
; cp : INT -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
comctl32 = windows.NewLazySystemDLL("COMCTL32.dll")
procDPA_Grow = comctl32.NewProc("DPA_Grow")
)
// pdpa (HDPA), cp (INT)
r1, _, err := procDPA_Grow.Call(
uintptr(pdpa),
uintptr(cp),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction DPA_Grow(
pdpa: NativeInt; // HDPA
cp: Integer // INT
): BOOL; stdcall;
external 'COMCTL32.dll' name 'DPA_Grow';result := DllCall("COMCTL32\DPA_Grow"
, "Ptr", pdpa ; HDPA
, "Int", cp ; INT
, "Int") ; return: BOOL●DPA_Grow(pdpa, cp) = DLL("COMCTL32.dll", "bool DPA_Grow(int, int)")
# 呼び出し: DPA_Grow(pdpa, cp)
# pdpa : HDPA -> "int"
# cp : INT -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "comctl32" fn DPA_Grow(
pdpa: isize, // HDPA
cp: i32 // INT
) callconv(std.os.windows.WINAPI) i32;proc DPA_Grow(
pdpa: int, # HDPA
cp: int32 # INT
): int32 {.importc: "DPA_Grow", stdcall, dynlib: "COMCTL32.dll".}pragma(lib, "comctl32");
extern(Windows)
int DPA_Grow(
ptrdiff_t pdpa, // HDPA
int cp // INT
);ccall((:DPA_Grow, "COMCTL32.dll"), stdcall, Int32,
(Int, Int32),
pdpa, cp)
# pdpa : HDPA -> Int
# cp : INT -> Int32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t DPA_Grow(
intptr_t pdpa,
int32_t cp);
]]
local comctl32 = ffi.load("comctl32")
-- comctl32.DPA_Grow(pdpa, cp)
-- pdpa : HDPA
-- cp : INT
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('COMCTL32.dll');
const DPA_Grow = lib.func('__stdcall', 'DPA_Grow', 'int32_t', ['intptr_t', 'int32_t']);
// DPA_Grow(pdpa, cp)
// pdpa : HDPA -> 'intptr_t'
// cp : INT -> 'int32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("COMCTL32.dll", {
DPA_Grow: { parameters: ["isize", "i32"], result: "i32" },
});
// lib.symbols.DPA_Grow(pdpa, cp)
// pdpa : HDPA -> "isize"
// cp : INT -> "i32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t DPA_Grow(
intptr_t pdpa,
int32_t cp);
C, "COMCTL32.dll");
// $ffi->DPA_Grow(pdpa, cp);
// pdpa : HDPA
// cp : INT
// 構造体/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 Comctl32 extends StdCallLibrary {
Comctl32 INSTANCE = Native.load("comctl32", Comctl32.class);
boolean DPA_Grow(
long pdpa, // HDPA
int cp // INT
);
}@[Link("comctl32")]
lib LibCOMCTL32
fun DPA_Grow = DPA_Grow(
pdpa : LibC::SSizeT, # HDPA
cp : Int32 # INT
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef DPA_GrowNative = Int32 Function(IntPtr, Int32);
typedef DPA_GrowDart = int Function(int, int);
final DPA_Grow = DynamicLibrary.open('COMCTL32.dll')
.lookupFunction<DPA_GrowNative, DPA_GrowDart>('DPA_Grow');
// pdpa : HDPA -> IntPtr
// cp : INT -> Int32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function DPA_Grow(
pdpa: NativeInt; // HDPA
cp: Integer // INT
): BOOL; stdcall;
external 'COMCTL32.dll' name 'DPA_Grow';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "DPA_Grow"
c_DPA_Grow :: CIntPtr -> Int32 -> IO CInt
-- pdpa : HDPA -> CIntPtr
-- cp : INT -> Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let dpa_grow =
foreign "DPA_Grow"
(intptr_t @-> int32_t @-> returning int32_t)
(* pdpa : HDPA -> intptr_t *)
(* cp : INT -> int32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library comctl32 (t "COMCTL32.dll"))
(cffi:use-foreign-library comctl32)
(cffi:defcfun ("DPA_Grow" dpa-grow :convention :stdcall) :int32
(pdpa :int64) ; HDPA
(cp :int32)) ; INT
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $DPA_Grow = Win32::API::More->new('COMCTL32',
'BOOL DPA_Grow(LPARAM pdpa, int cp)');
# my $ret = $DPA_Grow->Call($pdpa, $cp);
# pdpa : HDPA -> LPARAM
# cp : INT -> int
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。