ホーム › Devices.Tapi › lineGetAgentCapsA
lineGetAgentCapsA
関数アドレスのACDエージェント機能や能力を取得する(ANSI版)。
シグネチャ
// TAPI32.dll (ANSI / -A)
#include <windows.h>
INT lineGetAgentCapsA(
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(ANSI)へのポインタ。 |
戻り値の型: INT
各言語での呼び出し定義
// TAPI32.dll (ANSI / -A)
#include <windows.h>
INT lineGetAgentCapsA(
DWORD hLineApp,
DWORD dwDeviceID,
DWORD dwAddressID,
DWORD dwAppAPIVersion,
LINEAGENTCAPS* lpAgentCaps
);[DllImport("TAPI32.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern int lineGetAgentCapsA(
uint hLineApp, // DWORD
uint dwDeviceID, // DWORD
uint dwAddressID, // DWORD
uint dwAppAPIVersion, // DWORD
IntPtr lpAgentCaps // LINEAGENTCAPS* in/out
);<DllImport("TAPI32.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function lineGetAgentCapsA(
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 lineGetAgentCapsA Lib "tapi32" ( _
ByVal hLineApp As Long, _
ByVal dwDeviceID As Long, _
ByVal dwAddressID As Long, _
ByVal dwAppAPIVersion As Long, _
ByVal lpAgentCaps As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
lineGetAgentCapsA = ctypes.windll.tapi32.lineGetAgentCapsA
lineGetAgentCapsA.restype = ctypes.c_int
lineGetAgentCapsA.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')
lineGetAgentCapsA = Fiddle::Function.new(
lib['lineGetAgentCapsA'],
[
-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)#[link(name = "tapi32")]
extern "system" {
fn lineGetAgentCapsA(
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.Ansi)]
public static extern int lineGetAgentCapsA(uint hLineApp, uint dwDeviceID, uint dwAddressID, uint dwAppAPIVersion, IntPtr lpAgentCaps);
"@
$api = Add-Type -MemberDefinition $sig -Name 'TAPI32_lineGetAgentCapsA' -Namespace Win32 -PassThru
# $api::lineGetAgentCapsA(hLineApp, dwDeviceID, dwAddressID, dwAppAPIVersion, lpAgentCaps)#uselib "TAPI32.dll"
#func global lineGetAgentCapsA "lineGetAgentCapsA" sptr, sptr, sptr, sptr, sptr
; lineGetAgentCapsA hLineApp, dwDeviceID, dwAddressID, dwAppAPIVersion, varptr(lpAgentCaps) ; 戻り値は stat
; hLineApp : DWORD -> "sptr"
; dwDeviceID : DWORD -> "sptr"
; dwAddressID : DWORD -> "sptr"
; dwAppAPIVersion : DWORD -> "sptr"
; lpAgentCaps : LINEAGENTCAPS* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "TAPI32.dll" #cfunc global lineGetAgentCapsA "lineGetAgentCapsA" int, int, int, int, var ; res = lineGetAgentCapsA(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 lineGetAgentCapsA "lineGetAgentCapsA" int, int, int, int, sptr ; res = lineGetAgentCapsA(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 lineGetAgentCapsA(DWORD hLineApp, DWORD dwDeviceID, DWORD dwAddressID, DWORD dwAppAPIVersion, LINEAGENTCAPS* lpAgentCaps) #uselib "TAPI32.dll" #cfunc global lineGetAgentCapsA "lineGetAgentCapsA" int, int, int, int, var ; res = lineGetAgentCapsA(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 lineGetAgentCapsA(DWORD hLineApp, DWORD dwDeviceID, DWORD dwAddressID, DWORD dwAppAPIVersion, LINEAGENTCAPS* lpAgentCaps) #uselib "TAPI32.dll" #cfunc global lineGetAgentCapsA "lineGetAgentCapsA" int, int, int, int, intptr ; res = lineGetAgentCapsA(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")
proclineGetAgentCapsA = tapi32.NewProc("lineGetAgentCapsA")
)
// hLineApp (DWORD), dwDeviceID (DWORD), dwAddressID (DWORD), dwAppAPIVersion (DWORD), lpAgentCaps (LINEAGENTCAPS* in/out)
r1, _, err := proclineGetAgentCapsA.Call(
uintptr(hLineApp),
uintptr(dwDeviceID),
uintptr(dwAddressID),
uintptr(dwAppAPIVersion),
uintptr(lpAgentCaps),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction lineGetAgentCapsA(
hLineApp: DWORD; // DWORD
dwDeviceID: DWORD; // DWORD
dwAddressID: DWORD; // DWORD
dwAppAPIVersion: DWORD; // DWORD
lpAgentCaps: Pointer // LINEAGENTCAPS* in/out
): Integer; stdcall;
external 'TAPI32.dll' name 'lineGetAgentCapsA';result := DllCall("TAPI32\lineGetAgentCapsA"
, "UInt", hLineApp ; DWORD
, "UInt", dwDeviceID ; DWORD
, "UInt", dwAddressID ; DWORD
, "UInt", dwAppAPIVersion ; DWORD
, "Ptr", lpAgentCaps ; LINEAGENTCAPS* in/out
, "Int") ; return: INT●lineGetAgentCapsA(hLineApp, dwDeviceID, dwAddressID, dwAppAPIVersion, lpAgentCaps) = DLL("TAPI32.dll", "int lineGetAgentCapsA(dword, dword, dword, dword, void*)")
# 呼び出し: lineGetAgentCapsA(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)。const std = @import("std");
extern "tapi32" fn lineGetAgentCapsA(
hLineApp: u32, // DWORD
dwDeviceID: u32, // DWORD
dwAddressID: u32, // DWORD
dwAppAPIVersion: u32, // DWORD
lpAgentCaps: [*c]LINEAGENTCAPS // LINEAGENTCAPS* in/out
) callconv(std.os.windows.WINAPI) i32;proc lineGetAgentCapsA(
hLineApp: uint32, # DWORD
dwDeviceID: uint32, # DWORD
dwAddressID: uint32, # DWORD
dwAppAPIVersion: uint32, # DWORD
lpAgentCaps: ptr LINEAGENTCAPS # LINEAGENTCAPS* in/out
): int32 {.importc: "lineGetAgentCapsA", stdcall, dynlib: "TAPI32.dll".}pragma(lib, "tapi32");
extern(Windows)
int lineGetAgentCapsA(
uint hLineApp, // DWORD
uint dwDeviceID, // DWORD
uint dwAddressID, // DWORD
uint dwAppAPIVersion, // DWORD
LINEAGENTCAPS* lpAgentCaps // LINEAGENTCAPS* in/out
);ccall((:lineGetAgentCapsA, "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 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t lineGetAgentCapsA(
uint32_t hLineApp,
uint32_t dwDeviceID,
uint32_t dwAddressID,
uint32_t dwAppAPIVersion,
void* lpAgentCaps);
]]
local tapi32 = ffi.load("tapi32")
-- tapi32.lineGetAgentCapsA(hLineApp, dwDeviceID, dwAddressID, dwAppAPIVersion, lpAgentCaps)
-- hLineApp : DWORD
-- dwDeviceID : DWORD
-- dwAddressID : DWORD
-- dwAppAPIVersion : DWORD
-- lpAgentCaps : LINEAGENTCAPS* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('TAPI32.dll');
const lineGetAgentCapsA = lib.func('__stdcall', 'lineGetAgentCapsA', 'int32_t', ['uint32_t', 'uint32_t', 'uint32_t', 'uint32_t', 'void *']);
// lineGetAgentCapsA(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", {
lineGetAgentCapsA: { parameters: ["u32", "u32", "u32", "u32", "pointer"], result: "i32" },
});
// lib.symbols.lineGetAgentCapsA(hLineApp, dwDeviceID, dwAddressID, dwAppAPIVersion, lpAgentCaps)
// hLineApp : DWORD -> "u32"
// dwDeviceID : DWORD -> "u32"
// dwAddressID : DWORD -> "u32"
// dwAppAPIVersion : DWORD -> "u32"
// lpAgentCaps : LINEAGENTCAPS* in/out -> "pointer"
// 文字列は "buffer"。ANSI(-A) は new TextEncoder() で UTF-8/ANSI バイト列(末尾に \x00)を渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t lineGetAgentCapsA(
uint32_t hLineApp,
uint32_t dwDeviceID,
uint32_t dwAddressID,
uint32_t dwAppAPIVersion,
void* lpAgentCaps);
C, "TAPI32.dll");
// $ffi->lineGetAgentCapsA(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.ASCII_OPTIONS);
int lineGetAgentCapsA(
int hLineApp, // DWORD
int dwDeviceID, // DWORD
int dwAddressID, // DWORD
int dwAppAPIVersion, // DWORD
Pointer lpAgentCaps // LINEAGENTCAPS* in/out
);
}@[Link("tapi32")]
lib LibTAPI32
fun lineGetAgentCapsA = lineGetAgentCapsA(
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 lineGetAgentCapsANative = Int32 Function(Uint32, Uint32, Uint32, Uint32, Pointer<Void>);
typedef lineGetAgentCapsADart = int Function(int, int, int, int, Pointer<Void>);
final lineGetAgentCapsA = DynamicLibrary.open('TAPI32.dll')
.lookupFunction<lineGetAgentCapsANative, lineGetAgentCapsADart>('lineGetAgentCapsA');
// 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 lineGetAgentCapsA(
hLineApp: DWORD; // DWORD
dwDeviceID: DWORD; // DWORD
dwAddressID: DWORD; // DWORD
dwAppAPIVersion: DWORD; // DWORD
lpAgentCaps: Pointer // LINEAGENTCAPS* in/out
): Integer; stdcall;
external 'TAPI32.dll' name 'lineGetAgentCapsA';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "lineGetAgentCapsA"
c_lineGetAgentCapsA :: 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 linegetagentcapsa =
foreign "lineGetAgentCapsA"
(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 ("lineGetAgentCapsA" line-get-agent-caps-a :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 $lineGetAgentCapsA = Win32::API::More->new('TAPI32',
'int lineGetAgentCapsA(DWORD hLineApp, DWORD dwDeviceID, DWORD dwAddressID, DWORD dwAppAPIVersion, LPVOID lpAgentCaps)');
# my $ret = $lineGetAgentCapsA->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 を使用。関連項目
文字セット違い
- f lineGetAgentCapsW (Unicode版) — アドレスのACDエージェント機能や能力を取得する(Unicode版)。
使用する型