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

CopyAcceleratorTableA

関数
アクセラレータテーブルの内容を複製する(ANSI)。
DLLUSER32.dll文字セットANSI (-A)呼出規約winapi対応OSWindows 2000 以降

シグネチャ

// USER32.dll  (ANSI / -A)
#include <windows.h>

INT CopyAcceleratorTableA(
    HACCEL hAccelSrc,
    ACCEL* lpAccelDst,   // optional
    INT cAccelEntries
);

パラメーター

名前方向
hAccelSrcHACCELin
lpAccelDstACCEL*outoptional
cAccelEntriesINTin

戻り値の型: INT

各言語での呼び出し定義

// USER32.dll  (ANSI / -A)
#include <windows.h>

INT CopyAcceleratorTableA(
    HACCEL hAccelSrc,
    ACCEL* lpAccelDst,   // optional
    INT cAccelEntries
);
[DllImport("USER32.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern int CopyAcceleratorTableA(
    IntPtr hAccelSrc,   // HACCEL
    IntPtr lpAccelDst,   // ACCEL* optional, out
    int cAccelEntries   // INT
);
<DllImport("USER32.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function CopyAcceleratorTableA(
    hAccelSrc As IntPtr,   ' HACCEL
    lpAccelDst As IntPtr,   ' ACCEL* optional, out
    cAccelEntries As Integer   ' INT
) As Integer
End Function
' hAccelSrc : HACCEL
' lpAccelDst : ACCEL* optional, out
' cAccelEntries : INT
Declare PtrSafe Function CopyAcceleratorTableA Lib "user32" ( _
    ByVal hAccelSrc As LongPtr, _
    ByVal lpAccelDst As LongPtr, _
    ByVal cAccelEntries As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

CopyAcceleratorTableA = ctypes.windll.user32.CopyAcceleratorTableA
CopyAcceleratorTableA.restype = ctypes.c_int
CopyAcceleratorTableA.argtypes = [
    wintypes.HANDLE,  # hAccelSrc : HACCEL
    ctypes.c_void_p,  # lpAccelDst : ACCEL* optional, out
    ctypes.c_int,  # cAccelEntries : INT
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('USER32.dll')
CopyAcceleratorTableA = Fiddle::Function.new(
  lib['CopyAcceleratorTableA'],
  [
    Fiddle::TYPE_VOIDP,  # hAccelSrc : HACCEL
    Fiddle::TYPE_VOIDP,  # lpAccelDst : ACCEL* optional, out
    Fiddle::TYPE_INT,  # cAccelEntries : INT
  ],
  Fiddle::TYPE_INT)
#[link(name = "user32")]
extern "system" {
    fn CopyAcceleratorTableA(
        hAccelSrc: *mut core::ffi::c_void,  // HACCEL
        lpAccelDst: *mut ACCEL,  // ACCEL* optional, out
        cAccelEntries: i32  // INT
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("USER32.dll", CharSet = CharSet.Ansi)]
public static extern int CopyAcceleratorTableA(IntPtr hAccelSrc, IntPtr lpAccelDst, int cAccelEntries);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USER32_CopyAcceleratorTableA' -Namespace Win32 -PassThru
# $api::CopyAcceleratorTableA(hAccelSrc, lpAccelDst, cAccelEntries)
#uselib "USER32.dll"
#func global CopyAcceleratorTableA "CopyAcceleratorTableA" sptr, sptr, sptr
; CopyAcceleratorTableA hAccelSrc, varptr(lpAccelDst), cAccelEntries   ; 戻り値は stat
; hAccelSrc : HACCEL -> "sptr"
; lpAccelDst : ACCEL* optional, out -> "sptr"
; cAccelEntries : INT -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "USER32.dll"
#cfunc global CopyAcceleratorTableA "CopyAcceleratorTableA" sptr, var, int
; res = CopyAcceleratorTableA(hAccelSrc, lpAccelDst, cAccelEntries)
; hAccelSrc : HACCEL -> "sptr"
; lpAccelDst : ACCEL* optional, out -> "var"
; cAccelEntries : INT -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; INT CopyAcceleratorTableA(HACCEL hAccelSrc, ACCEL* lpAccelDst, INT cAccelEntries)
#uselib "USER32.dll"
#cfunc global CopyAcceleratorTableA "CopyAcceleratorTableA" intptr, var, int
; res = CopyAcceleratorTableA(hAccelSrc, lpAccelDst, cAccelEntries)
; hAccelSrc : HACCEL -> "intptr"
; lpAccelDst : ACCEL* optional, out -> "var"
; cAccelEntries : INT -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	user32 = windows.NewLazySystemDLL("USER32.dll")
	procCopyAcceleratorTableA = user32.NewProc("CopyAcceleratorTableA")
)

// hAccelSrc (HACCEL), lpAccelDst (ACCEL* optional, out), cAccelEntries (INT)
r1, _, err := procCopyAcceleratorTableA.Call(
	uintptr(hAccelSrc),
	uintptr(lpAccelDst),
	uintptr(cAccelEntries),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // INT
function CopyAcceleratorTableA(
  hAccelSrc: THandle;   // HACCEL
  lpAccelDst: Pointer;   // ACCEL* optional, out
  cAccelEntries: Integer   // INT
): Integer; stdcall;
  external 'USER32.dll' name 'CopyAcceleratorTableA';
result := DllCall("USER32\CopyAcceleratorTableA"
    , "Ptr", hAccelSrc   ; HACCEL
    , "Ptr", lpAccelDst   ; ACCEL* optional, out
    , "Int", cAccelEntries   ; INT
    , "Int")   ; return: INT
●CopyAcceleratorTableA(hAccelSrc, lpAccelDst, cAccelEntries) = DLL("USER32.dll", "int CopyAcceleratorTableA(void*, void*, int)")
# 呼び出し: CopyAcceleratorTableA(hAccelSrc, lpAccelDst, cAccelEntries)
# hAccelSrc : HACCEL -> "void*"
# lpAccelDst : ACCEL* optional, out -> "void*"
# cAccelEntries : INT -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。