ホーム › UI.WindowsAndMessaging › CopyAcceleratorTableW
CopyAcceleratorTableW
関数アクセラレータテーブルの内容を複製する(Unicode)。
シグネチャ
// USER32.dll (Unicode / -W)
#include <windows.h>
INT CopyAcceleratorTableW(
HACCEL hAccelSrc,
ACCEL* lpAccelDst, // optional
INT cAccelEntries
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hAccelSrc | HACCEL | in |
| lpAccelDst | ACCEL* | outoptional |
| cAccelEntries | INT | in |
戻り値の型: INT
各言語での呼び出し定義
// USER32.dll (Unicode / -W)
#include <windows.h>
INT CopyAcceleratorTableW(
HACCEL hAccelSrc,
ACCEL* lpAccelDst, // optional
INT cAccelEntries
);[DllImport("USER32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern int CopyAcceleratorTableW(
IntPtr hAccelSrc, // HACCEL
IntPtr lpAccelDst, // ACCEL* optional, out
int cAccelEntries // INT
);<DllImport("USER32.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function CopyAcceleratorTableW(
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 CopyAcceleratorTableW Lib "user32" ( _
ByVal hAccelSrc As LongPtr, _
ByVal lpAccelDst As LongPtr, _
ByVal cAccelEntries As Long) As Long
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
CopyAcceleratorTableW = ctypes.windll.user32.CopyAcceleratorTableW
CopyAcceleratorTableW.restype = ctypes.c_int
CopyAcceleratorTableW.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')
CopyAcceleratorTableW = Fiddle::Function.new(
lib['CopyAcceleratorTableW'],
[
Fiddle::TYPE_VOIDP, # hAccelSrc : HACCEL
Fiddle::TYPE_VOIDP, # lpAccelDst : ACCEL* optional, out
Fiddle::TYPE_INT, # cAccelEntries : INT
],
Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "user32")]
extern "system" {
fn CopyAcceleratorTableW(
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.Unicode)]
public static extern int CopyAcceleratorTableW(IntPtr hAccelSrc, IntPtr lpAccelDst, int cAccelEntries);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USER32_CopyAcceleratorTableW' -Namespace Win32 -PassThru
# $api::CopyAcceleratorTableW(hAccelSrc, lpAccelDst, cAccelEntries)#uselib "USER32.dll"
#func global CopyAcceleratorTableW "CopyAcceleratorTableW" wptr, wptr, wptr
; CopyAcceleratorTableW hAccelSrc, varptr(lpAccelDst), cAccelEntries ; 戻り値は stat
; hAccelSrc : HACCEL -> "wptr"
; lpAccelDst : ACCEL* optional, out -> "wptr"
; cAccelEntries : INT -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "USER32.dll" #cfunc global CopyAcceleratorTableW "CopyAcceleratorTableW" sptr, var, int ; res = CopyAcceleratorTableW(hAccelSrc, lpAccelDst, cAccelEntries) ; hAccelSrc : HACCEL -> "sptr" ; lpAccelDst : ACCEL* optional, out -> "var" ; cAccelEntries : INT -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "USER32.dll" #cfunc global CopyAcceleratorTableW "CopyAcceleratorTableW" sptr, sptr, int ; res = CopyAcceleratorTableW(hAccelSrc, varptr(lpAccelDst), cAccelEntries) ; hAccelSrc : HACCEL -> "sptr" ; lpAccelDst : ACCEL* optional, out -> "sptr" ; cAccelEntries : INT -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; INT CopyAcceleratorTableW(HACCEL hAccelSrc, ACCEL* lpAccelDst, INT cAccelEntries) #uselib "USER32.dll" #cfunc global CopyAcceleratorTableW "CopyAcceleratorTableW" intptr, var, int ; res = CopyAcceleratorTableW(hAccelSrc, lpAccelDst, cAccelEntries) ; hAccelSrc : HACCEL -> "intptr" ; lpAccelDst : ACCEL* optional, out -> "var" ; cAccelEntries : INT -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; INT CopyAcceleratorTableW(HACCEL hAccelSrc, ACCEL* lpAccelDst, INT cAccelEntries) #uselib "USER32.dll" #cfunc global CopyAcceleratorTableW "CopyAcceleratorTableW" intptr, intptr, int ; res = CopyAcceleratorTableW(hAccelSrc, varptr(lpAccelDst), cAccelEntries) ; hAccelSrc : HACCEL -> "intptr" ; lpAccelDst : ACCEL* optional, out -> "intptr" ; cAccelEntries : INT -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
user32 = windows.NewLazySystemDLL("USER32.dll")
procCopyAcceleratorTableW = user32.NewProc("CopyAcceleratorTableW")
)
// hAccelSrc (HACCEL), lpAccelDst (ACCEL* optional, out), cAccelEntries (INT)
r1, _, err := procCopyAcceleratorTableW.Call(
uintptr(hAccelSrc),
uintptr(lpAccelDst),
uintptr(cAccelEntries),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction CopyAcceleratorTableW(
hAccelSrc: THandle; // HACCEL
lpAccelDst: Pointer; // ACCEL* optional, out
cAccelEntries: Integer // INT
): Integer; stdcall;
external 'USER32.dll' name 'CopyAcceleratorTableW';result := DllCall("USER32\CopyAcceleratorTableW"
, "Ptr", hAccelSrc ; HACCEL
, "Ptr", lpAccelDst ; ACCEL* optional, out
, "Int", cAccelEntries ; INT
, "Int") ; return: INT●CopyAcceleratorTableW(hAccelSrc, lpAccelDst, cAccelEntries) = DLL("USER32.dll", "int CopyAcceleratorTableW(void*, void*, int)")
# 呼び出し: CopyAcceleratorTableW(hAccelSrc, lpAccelDst, cAccelEntries)
# hAccelSrc : HACCEL -> "void*"
# lpAccelDst : ACCEL* optional, out -> "void*"
# cAccelEntries : INT -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。