ホーム › Devices.Tapi › lineGetAgentCapsW
lineGetAgentCapsW
関数アドレスのACDエージェント機能や能力を取得する(Unicode版)。
シグネチャ
// TAPI32.dll (Unicode / -W)
#include <windows.h>
INT lineGetAgentCapsW(
DWORD hLineApp,
DWORD dwDeviceID,
DWORD dwAddressID,
DWORD dwAppAPIVersion,
LINEAGENTCAPS* lpAgentCaps
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hLineApp | DWORD | in | lineInitializeで取得したアプリの使用ハンドル。 |
| dwDeviceID | DWORD | in | 対象の回線デバイスID。 |
| dwAddressID | DWORD | in | 対象アドレスの0起点ID。 |
| dwAppAPIVersion | DWORD | in | アプリが使用するTAPI APIバージョンを指定する。 |
| lpAgentCaps | LINEAGENTCAPS* | inout | エージェント能力を受け取るLINEAGENTCAPS(Unicode)へのポインタ。 |
戻り値の型: INT
各言語での呼び出し定義
// TAPI32.dll (Unicode / -W)
#include <windows.h>
INT lineGetAgentCapsW(
DWORD hLineApp,
DWORD dwDeviceID,
DWORD dwAddressID,
DWORD dwAppAPIVersion,
LINEAGENTCAPS* lpAgentCaps
);[DllImport("TAPI32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern int lineGetAgentCapsW(
uint hLineApp, // DWORD
uint dwDeviceID, // DWORD
uint dwAddressID, // DWORD
uint dwAppAPIVersion, // DWORD
IntPtr lpAgentCaps // LINEAGENTCAPS* in/out
);<DllImport("TAPI32.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function lineGetAgentCapsW(
hLineApp As UInteger, ' DWORD
dwDeviceID As UInteger, ' DWORD
dwAddressID As UInteger, ' DWORD
dwAppAPIVersion As UInteger, ' DWORD
lpAgentCaps As IntPtr ' LINEAGENTCAPS* in/out
) As Integer
End Function' hLineApp : DWORD
' dwDeviceID : DWORD
' dwAddressID : DWORD
' dwAppAPIVersion : DWORD
' lpAgentCaps : LINEAGENTCAPS* in/out
Declare PtrSafe Function lineGetAgentCapsW Lib "tapi32" ( _
ByVal hLineApp As Long, _
ByVal dwDeviceID As Long, _
ByVal dwAddressID As Long, _
ByVal dwAppAPIVersion As Long, _
ByVal lpAgentCaps As LongPtr) 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
lineGetAgentCapsW = ctypes.windll.tapi32.lineGetAgentCapsW
lineGetAgentCapsW.restype = ctypes.c_int
lineGetAgentCapsW.argtypes = [
wintypes.DWORD, # hLineApp : DWORD
wintypes.DWORD, # dwDeviceID : DWORD
wintypes.DWORD, # dwAddressID : DWORD
wintypes.DWORD, # dwAppAPIVersion : DWORD
ctypes.c_void_p, # lpAgentCaps : LINEAGENTCAPS* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('TAPI32.dll')
lineGetAgentCapsW = Fiddle::Function.new(
lib['lineGetAgentCapsW'],
[
-Fiddle::TYPE_INT, # hLineApp : DWORD
-Fiddle::TYPE_INT, # dwDeviceID : DWORD
-Fiddle::TYPE_INT, # dwAddressID : DWORD
-Fiddle::TYPE_INT, # dwAppAPIVersion : DWORD
Fiddle::TYPE_VOIDP, # lpAgentCaps : LINEAGENTCAPS* in/out
],
Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "tapi32")]
extern "system" {
fn lineGetAgentCapsW(
hLineApp: u32, // DWORD
dwDeviceID: u32, // DWORD
dwAddressID: u32, // DWORD
dwAppAPIVersion: u32, // DWORD
lpAgentCaps: *mut LINEAGENTCAPS // LINEAGENTCAPS* in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("TAPI32.dll", CharSet = CharSet.Unicode)]
public static extern int lineGetAgentCapsW(uint hLineApp, uint dwDeviceID, uint dwAddressID, uint dwAppAPIVersion, IntPtr lpAgentCaps);
"@
$api = Add-Type -MemberDefinition $sig -Name 'TAPI32_lineGetAgentCapsW' -Namespace Win32 -PassThru
# $api::lineGetAgentCapsW(hLineApp, dwDeviceID, dwAddressID, dwAppAPIVersion, lpAgentCaps)#uselib "TAPI32.dll"
#func global lineGetAgentCapsW "lineGetAgentCapsW" wptr, wptr, wptr, wptr, wptr
; lineGetAgentCapsW hLineApp, dwDeviceID, dwAddressID, dwAppAPIVersion, varptr(lpAgentCaps) ; 戻り値は stat
; hLineApp : DWORD -> "wptr"
; dwDeviceID : DWORD -> "wptr"
; dwAddressID : DWORD -> "wptr"
; dwAppAPIVersion : DWORD -> "wptr"
; lpAgentCaps : LINEAGENTCAPS* in/out -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "TAPI32.dll" #cfunc global lineGetAgentCapsW "lineGetAgentCapsW" int, int, int, int, var ; res = lineGetAgentCapsW(hLineApp, dwDeviceID, dwAddressID, dwAppAPIVersion, lpAgentCaps) ; hLineApp : DWORD -> "int" ; dwDeviceID : DWORD -> "int" ; dwAddressID : DWORD -> "int" ; dwAppAPIVersion : DWORD -> "int" ; lpAgentCaps : LINEAGENTCAPS* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "TAPI32.dll" #cfunc global lineGetAgentCapsW "lineGetAgentCapsW" int, int, int, int, sptr ; res = lineGetAgentCapsW(hLineApp, dwDeviceID, dwAddressID, dwAppAPIVersion, varptr(lpAgentCaps)) ; hLineApp : DWORD -> "int" ; dwDeviceID : DWORD -> "int" ; dwAddressID : DWORD -> "int" ; dwAppAPIVersion : DWORD -> "int" ; lpAgentCaps : LINEAGENTCAPS* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; INT lineGetAgentCapsW(DWORD hLineApp, DWORD dwDeviceID, DWORD dwAddressID, DWORD dwAppAPIVersion, LINEAGENTCAPS* lpAgentCaps) #uselib "TAPI32.dll" #cfunc global lineGetAgentCapsW "lineGetAgentCapsW" int, int, int, int, var ; res = lineGetAgentCapsW(hLineApp, dwDeviceID, dwAddressID, dwAppAPIVersion, lpAgentCaps) ; hLineApp : DWORD -> "int" ; dwDeviceID : DWORD -> "int" ; dwAddressID : DWORD -> "int" ; dwAppAPIVersion : DWORD -> "int" ; lpAgentCaps : LINEAGENTCAPS* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; INT lineGetAgentCapsW(DWORD hLineApp, DWORD dwDeviceID, DWORD dwAddressID, DWORD dwAppAPIVersion, LINEAGENTCAPS* lpAgentCaps) #uselib "TAPI32.dll" #cfunc global lineGetAgentCapsW "lineGetAgentCapsW" int, int, int, int, intptr ; res = lineGetAgentCapsW(hLineApp, dwDeviceID, dwAddressID, dwAppAPIVersion, varptr(lpAgentCaps)) ; hLineApp : DWORD -> "int" ; dwDeviceID : DWORD -> "int" ; dwAddressID : DWORD -> "int" ; dwAppAPIVersion : DWORD -> "int" ; lpAgentCaps : LINEAGENTCAPS* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
tapi32 = windows.NewLazySystemDLL("TAPI32.dll")
proclineGetAgentCapsW = tapi32.NewProc("lineGetAgentCapsW")
)
// hLineApp (DWORD), dwDeviceID (DWORD), dwAddressID (DWORD), dwAppAPIVersion (DWORD), lpAgentCaps (LINEAGENTCAPS* in/out)
r1, _, err := proclineGetAgentCapsW.Call(
uintptr(hLineApp),
uintptr(dwDeviceID),
uintptr(dwAddressID),
uintptr(dwAppAPIVersion),
uintptr(lpAgentCaps),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction lineGetAgentCapsW(
hLineApp: DWORD; // DWORD
dwDeviceID: DWORD; // DWORD
dwAddressID: DWORD; // DWORD
dwAppAPIVersion: DWORD; // DWORD
lpAgentCaps: Pointer // LINEAGENTCAPS* in/out
): Integer; stdcall;
external 'TAPI32.dll' name 'lineGetAgentCapsW';result := DllCall("TAPI32\lineGetAgentCapsW"
, "UInt", hLineApp ; DWORD
, "UInt", dwDeviceID ; DWORD
, "UInt", dwAddressID ; DWORD
, "UInt", dwAppAPIVersion ; DWORD
, "Ptr", lpAgentCaps ; LINEAGENTCAPS* in/out
, "Int") ; return: INT●lineGetAgentCapsW(hLineApp, dwDeviceID, dwAddressID, dwAppAPIVersion, lpAgentCaps) = DLL("TAPI32.dll", "int lineGetAgentCapsW(dword, dword, dword, dword, void*)")
# 呼び出し: lineGetAgentCapsW(hLineApp, dwDeviceID, dwAddressID, dwAppAPIVersion, lpAgentCaps)
# hLineApp : DWORD -> "dword"
# dwDeviceID : DWORD -> "dword"
# dwAddressID : DWORD -> "dword"
# dwAppAPIVersion : DWORD -> "dword"
# lpAgentCaps : LINEAGENTCAPS* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。const std = @import("std");
extern "tapi32" fn lineGetAgentCapsW(
hLineApp: u32, // DWORD
dwDeviceID: u32, // DWORD
dwAddressID: u32, // DWORD
dwAppAPIVersion: u32, // DWORD
lpAgentCaps: [*c]LINEAGENTCAPS // LINEAGENTCAPS* in/out
) callconv(std.os.windows.WINAPI) i32;
// Unicode(-W): UTF-16LE のヌル終端バッファ([*c]const u16)を渡す。proc lineGetAgentCapsW(
hLineApp: uint32, # DWORD
dwDeviceID: uint32, # DWORD
dwAddressID: uint32, # DWORD
dwAppAPIVersion: uint32, # DWORD
lpAgentCaps: ptr LINEAGENTCAPS # LINEAGENTCAPS* in/out
): int32 {.importc: "lineGetAgentCapsW", stdcall, dynlib: "TAPI32.dll".}
# Unicode(-W): WideCString は newWideCString("...") で生成。pragma(lib, "tapi32");
extern(Windows)
int lineGetAgentCapsW(
uint hLineApp, // DWORD
uint dwDeviceID, // DWORD
uint dwAddressID, // DWORD
uint dwAppAPIVersion, // DWORD
LINEAGENTCAPS* lpAgentCaps // LINEAGENTCAPS* in/out
);ccall((:lineGetAgentCapsW, "TAPI32.dll"), stdcall, Int32,
(UInt32, UInt32, UInt32, UInt32, Ptr{LINEAGENTCAPS}),
hLineApp, dwDeviceID, dwAddressID, dwAppAPIVersion, lpAgentCaps)
# hLineApp : DWORD -> UInt32
# dwDeviceID : DWORD -> UInt32
# dwAddressID : DWORD -> UInt32
# dwAppAPIVersion : DWORD -> UInt32
# lpAgentCaps : LINEAGENTCAPS* in/out -> Ptr{LINEAGENTCAPS}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
# Unicode(-W): Cwstring には transcode(UInt16, "...") 等で UTF-16 を渡す。local ffi = require("ffi")
ffi.cdef[[
int32_t lineGetAgentCapsW(
uint32_t hLineApp,
uint32_t dwDeviceID,
uint32_t dwAddressID,
uint32_t dwAppAPIVersion,
void* lpAgentCaps);
]]
local tapi32 = ffi.load("tapi32")
-- tapi32.lineGetAgentCapsW(hLineApp, dwDeviceID, dwAddressID, dwAppAPIVersion, lpAgentCaps)
-- hLineApp : DWORD
-- dwDeviceID : DWORD
-- dwAddressID : DWORD
-- dwAppAPIVersion : DWORD
-- lpAgentCaps : LINEAGENTCAPS* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
-- Unicode(-W): uint16_t* には UTF-16LE のバッファ(ffi.new("uint16_t[?]", ...))を渡す。const koffi = require('koffi');
const lib = koffi.load('TAPI32.dll');
const lineGetAgentCapsW = lib.func('__stdcall', 'lineGetAgentCapsW', 'int32_t', ['uint32_t', 'uint32_t', 'uint32_t', 'uint32_t', 'void *']);
// lineGetAgentCapsW(hLineApp, dwDeviceID, dwAddressID, dwAppAPIVersion, lpAgentCaps)
// hLineApp : DWORD -> 'uint32_t'
// dwDeviceID : DWORD -> 'uint32_t'
// dwAddressID : DWORD -> 'uint32_t'
// dwAppAPIVersion : DWORD -> 'uint32_t'
// lpAgentCaps : LINEAGENTCAPS* in/out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("TAPI32.dll", {
lineGetAgentCapsW: { parameters: ["u32", "u32", "u32", "u32", "pointer"], result: "i32" },
});
// lib.symbols.lineGetAgentCapsW(hLineApp, dwDeviceID, dwAddressID, dwAppAPIVersion, lpAgentCaps)
// hLineApp : DWORD -> "u32"
// dwDeviceID : DWORD -> "u32"
// dwAddressID : DWORD -> "u32"
// dwAppAPIVersion : DWORD -> "u32"
// lpAgentCaps : LINEAGENTCAPS* in/out -> "pointer"
// 文字列は "buffer"。Unicode(-W) は new TextEncoder() ではなく UTF-16LE のバイト列(末尾に \x00\x00)を Uint8Array で渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t lineGetAgentCapsW(
uint32_t hLineApp,
uint32_t dwDeviceID,
uint32_t dwAddressID,
uint32_t dwAppAPIVersion,
void* lpAgentCaps);
C, "TAPI32.dll");
// $ffi->lineGetAgentCapsW(hLineApp, dwDeviceID, dwAddressID, dwAppAPIVersion, lpAgentCaps);
// hLineApp : DWORD
// dwDeviceID : DWORD
// dwAddressID : DWORD
// dwAppAPIVersion : DWORD
// lpAgentCaps : LINEAGENTCAPS* in/out
// 構造体/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 Tapi32 extends StdCallLibrary {
Tapi32 INSTANCE = Native.load("tapi32", Tapi32.class, W32APIOptions.UNICODE_OPTIONS);
int lineGetAgentCapsW(
int hLineApp, // DWORD
int dwDeviceID, // DWORD
int dwAddressID, // DWORD
int dwAppAPIVersion, // DWORD
Pointer lpAgentCaps // LINEAGENTCAPS* in/out
);
}
// Unicode(-W): WString(入力)/char[](出力)で UTF-16 をマーシャリング。@[Link("tapi32")]
lib LibTAPI32
fun lineGetAgentCapsW = lineGetAgentCapsW(
hLineApp : UInt32, # DWORD
dwDeviceID : UInt32, # DWORD
dwAddressID : UInt32, # DWORD
dwAppAPIVersion : UInt32, # DWORD
lpAgentCaps : LINEAGENTCAPS* # LINEAGENTCAPS* in/out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef lineGetAgentCapsWNative = Int32 Function(Uint32, Uint32, Uint32, Uint32, Pointer<Void>);
typedef lineGetAgentCapsWDart = int Function(int, int, int, int, Pointer<Void>);
final lineGetAgentCapsW = DynamicLibrary.open('TAPI32.dll')
.lookupFunction<lineGetAgentCapsWNative, lineGetAgentCapsWDart>('lineGetAgentCapsW');
// hLineApp : DWORD -> Uint32
// dwDeviceID : DWORD -> Uint32
// dwAddressID : DWORD -> Uint32
// dwAppAPIVersion : DWORD -> Uint32
// lpAgentCaps : LINEAGENTCAPS* in/out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function lineGetAgentCapsW(
hLineApp: DWORD; // DWORD
dwDeviceID: DWORD; // DWORD
dwAddressID: DWORD; // DWORD
dwAppAPIVersion: DWORD; // DWORD
lpAgentCaps: Pointer // LINEAGENTCAPS* in/out
): Integer; stdcall;
external 'TAPI32.dll' name 'lineGetAgentCapsW';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "lineGetAgentCapsW"
c_lineGetAgentCapsW :: Word32 -> Word32 -> Word32 -> Word32 -> Ptr () -> IO Int32
-- hLineApp : DWORD -> Word32
-- dwDeviceID : DWORD -> Word32
-- dwAddressID : DWORD -> Word32
-- dwAppAPIVersion : DWORD -> Word32
-- lpAgentCaps : LINEAGENTCAPS* in/out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let linegetagentcapsw =
foreign "lineGetAgentCapsW"
(uint32_t @-> uint32_t @-> uint32_t @-> uint32_t @-> (ptr void) @-> returning int32_t)
(* hLineApp : DWORD -> uint32_t *)
(* dwDeviceID : DWORD -> uint32_t *)
(* dwAddressID : DWORD -> uint32_t *)
(* dwAppAPIVersion : DWORD -> uint32_t *)
(* lpAgentCaps : LINEAGENTCAPS* in/out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library tapi32 (t "TAPI32.dll"))
(cffi:use-foreign-library tapi32)
(cffi:defcfun ("lineGetAgentCapsW" line-get-agent-caps-w :convention :stdcall) :int32
(h-line-app :uint32) ; DWORD
(dw-device-id :uint32) ; DWORD
(dw-address-id :uint32) ; DWORD
(dw-app-apiversion :uint32) ; DWORD
(lp-agent-caps :pointer)) ; LINEAGENTCAPS* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $lineGetAgentCapsW = Win32::API::More->new('TAPI32',
'int lineGetAgentCapsW(DWORD hLineApp, DWORD dwDeviceID, DWORD dwAddressID, DWORD dwAppAPIVersion, LPVOID lpAgentCaps)');
# my $ret = $lineGetAgentCapsW->Call($hLineApp, $dwDeviceID, $dwAddressID, $dwAppAPIVersion, $lpAgentCaps);
# hLineApp : DWORD -> DWORD
# dwDeviceID : DWORD -> DWORD
# dwAddressID : DWORD -> DWORD
# dwAppAPIVersion : DWORD -> DWORD
# lpAgentCaps : LINEAGENTCAPS* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# Unicode(-W): LPCWSTR/LPWSTR は Win32::API が UTF-16 変換を行う。関連項目
文字セット違い
- f lineGetAgentCapsA (ANSI版) — アドレスのACDエージェント機能や能力を取得する(ANSI版)。
使用する型