ホーム › Devices.Tapi › lineGetAgentStatusA
lineGetAgentStatusA
関数アドレスのACDエージェントの現在の状態を取得する(ANSI版)。
シグネチャ
// TAPI32.dll (ANSI / -A)
#include <windows.h>
INT lineGetAgentStatusA(
DWORD hLine,
DWORD dwAddressID,
LINEAGENTSTATUS* lpAgentStatus
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hLine | DWORD | in | 対象の回線デバイスハンドル。 |
| dwAddressID | DWORD | in | 対象アドレスの0起点ID。 |
| lpAgentStatus | LINEAGENTSTATUS* | inout | エージェント状態を受け取るLINEAGENTSTATUS(ANSI)へのポインタ。 |
戻り値の型: INT
各言語での呼び出し定義
// TAPI32.dll (ANSI / -A)
#include <windows.h>
INT lineGetAgentStatusA(
DWORD hLine,
DWORD dwAddressID,
LINEAGENTSTATUS* lpAgentStatus
);[DllImport("TAPI32.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern int lineGetAgentStatusA(
uint hLine, // DWORD
uint dwAddressID, // DWORD
IntPtr lpAgentStatus // LINEAGENTSTATUS* in/out
);<DllImport("TAPI32.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function lineGetAgentStatusA(
hLine As UInteger, ' DWORD
dwAddressID As UInteger, ' DWORD
lpAgentStatus As IntPtr ' LINEAGENTSTATUS* in/out
) As Integer
End Function' hLine : DWORD
' dwAddressID : DWORD
' lpAgentStatus : LINEAGENTSTATUS* in/out
Declare PtrSafe Function lineGetAgentStatusA Lib "tapi32" ( _
ByVal hLine As Long, _
ByVal dwAddressID As Long, _
ByVal lpAgentStatus As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
lineGetAgentStatusA = ctypes.windll.tapi32.lineGetAgentStatusA
lineGetAgentStatusA.restype = ctypes.c_int
lineGetAgentStatusA.argtypes = [
wintypes.DWORD, # hLine : DWORD
wintypes.DWORD, # dwAddressID : DWORD
ctypes.c_void_p, # lpAgentStatus : LINEAGENTSTATUS* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('TAPI32.dll')
lineGetAgentStatusA = Fiddle::Function.new(
lib['lineGetAgentStatusA'],
[
-Fiddle::TYPE_INT, # hLine : DWORD
-Fiddle::TYPE_INT, # dwAddressID : DWORD
Fiddle::TYPE_VOIDP, # lpAgentStatus : LINEAGENTSTATUS* in/out
],
Fiddle::TYPE_INT)#[link(name = "tapi32")]
extern "system" {
fn lineGetAgentStatusA(
hLine: u32, // DWORD
dwAddressID: u32, // DWORD
lpAgentStatus: *mut LINEAGENTSTATUS // LINEAGENTSTATUS* in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("TAPI32.dll", CharSet = CharSet.Ansi)]
public static extern int lineGetAgentStatusA(uint hLine, uint dwAddressID, IntPtr lpAgentStatus);
"@
$api = Add-Type -MemberDefinition $sig -Name 'TAPI32_lineGetAgentStatusA' -Namespace Win32 -PassThru
# $api::lineGetAgentStatusA(hLine, dwAddressID, lpAgentStatus)#uselib "TAPI32.dll"
#func global lineGetAgentStatusA "lineGetAgentStatusA" sptr, sptr, sptr
; lineGetAgentStatusA hLine, dwAddressID, varptr(lpAgentStatus) ; 戻り値は stat
; hLine : DWORD -> "sptr"
; dwAddressID : DWORD -> "sptr"
; lpAgentStatus : LINEAGENTSTATUS* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "TAPI32.dll" #cfunc global lineGetAgentStatusA "lineGetAgentStatusA" int, int, var ; res = lineGetAgentStatusA(hLine, dwAddressID, lpAgentStatus) ; hLine : DWORD -> "int" ; dwAddressID : DWORD -> "int" ; lpAgentStatus : LINEAGENTSTATUS* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "TAPI32.dll" #cfunc global lineGetAgentStatusA "lineGetAgentStatusA" int, int, sptr ; res = lineGetAgentStatusA(hLine, dwAddressID, varptr(lpAgentStatus)) ; hLine : DWORD -> "int" ; dwAddressID : DWORD -> "int" ; lpAgentStatus : LINEAGENTSTATUS* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; INT lineGetAgentStatusA(DWORD hLine, DWORD dwAddressID, LINEAGENTSTATUS* lpAgentStatus) #uselib "TAPI32.dll" #cfunc global lineGetAgentStatusA "lineGetAgentStatusA" int, int, var ; res = lineGetAgentStatusA(hLine, dwAddressID, lpAgentStatus) ; hLine : DWORD -> "int" ; dwAddressID : DWORD -> "int" ; lpAgentStatus : LINEAGENTSTATUS* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; INT lineGetAgentStatusA(DWORD hLine, DWORD dwAddressID, LINEAGENTSTATUS* lpAgentStatus) #uselib "TAPI32.dll" #cfunc global lineGetAgentStatusA "lineGetAgentStatusA" int, int, intptr ; res = lineGetAgentStatusA(hLine, dwAddressID, varptr(lpAgentStatus)) ; hLine : DWORD -> "int" ; dwAddressID : DWORD -> "int" ; lpAgentStatus : LINEAGENTSTATUS* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
tapi32 = windows.NewLazySystemDLL("TAPI32.dll")
proclineGetAgentStatusA = tapi32.NewProc("lineGetAgentStatusA")
)
// hLine (DWORD), dwAddressID (DWORD), lpAgentStatus (LINEAGENTSTATUS* in/out)
r1, _, err := proclineGetAgentStatusA.Call(
uintptr(hLine),
uintptr(dwAddressID),
uintptr(lpAgentStatus),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction lineGetAgentStatusA(
hLine: DWORD; // DWORD
dwAddressID: DWORD; // DWORD
lpAgentStatus: Pointer // LINEAGENTSTATUS* in/out
): Integer; stdcall;
external 'TAPI32.dll' name 'lineGetAgentStatusA';result := DllCall("TAPI32\lineGetAgentStatusA"
, "UInt", hLine ; DWORD
, "UInt", dwAddressID ; DWORD
, "Ptr", lpAgentStatus ; LINEAGENTSTATUS* in/out
, "Int") ; return: INT●lineGetAgentStatusA(hLine, dwAddressID, lpAgentStatus) = DLL("TAPI32.dll", "int lineGetAgentStatusA(dword, dword, void*)")
# 呼び出し: lineGetAgentStatusA(hLine, dwAddressID, lpAgentStatus)
# hLine : DWORD -> "dword"
# dwAddressID : DWORD -> "dword"
# lpAgentStatus : LINEAGENTSTATUS* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "tapi32" fn lineGetAgentStatusA(
hLine: u32, // DWORD
dwAddressID: u32, // DWORD
lpAgentStatus: [*c]LINEAGENTSTATUS // LINEAGENTSTATUS* in/out
) callconv(std.os.windows.WINAPI) i32;proc lineGetAgentStatusA(
hLine: uint32, # DWORD
dwAddressID: uint32, # DWORD
lpAgentStatus: ptr LINEAGENTSTATUS # LINEAGENTSTATUS* in/out
): int32 {.importc: "lineGetAgentStatusA", stdcall, dynlib: "TAPI32.dll".}pragma(lib, "tapi32");
extern(Windows)
int lineGetAgentStatusA(
uint hLine, // DWORD
uint dwAddressID, // DWORD
LINEAGENTSTATUS* lpAgentStatus // LINEAGENTSTATUS* in/out
);ccall((:lineGetAgentStatusA, "TAPI32.dll"), stdcall, Int32,
(UInt32, UInt32, Ptr{LINEAGENTSTATUS}),
hLine, dwAddressID, lpAgentStatus)
# hLine : DWORD -> UInt32
# dwAddressID : DWORD -> UInt32
# lpAgentStatus : LINEAGENTSTATUS* in/out -> Ptr{LINEAGENTSTATUS}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t lineGetAgentStatusA(
uint32_t hLine,
uint32_t dwAddressID,
void* lpAgentStatus);
]]
local tapi32 = ffi.load("tapi32")
-- tapi32.lineGetAgentStatusA(hLine, dwAddressID, lpAgentStatus)
-- hLine : DWORD
-- dwAddressID : DWORD
-- lpAgentStatus : LINEAGENTSTATUS* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('TAPI32.dll');
const lineGetAgentStatusA = lib.func('__stdcall', 'lineGetAgentStatusA', 'int32_t', ['uint32_t', 'uint32_t', 'void *']);
// lineGetAgentStatusA(hLine, dwAddressID, lpAgentStatus)
// hLine : DWORD -> 'uint32_t'
// dwAddressID : DWORD -> 'uint32_t'
// lpAgentStatus : LINEAGENTSTATUS* in/out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("TAPI32.dll", {
lineGetAgentStatusA: { parameters: ["u32", "u32", "pointer"], result: "i32" },
});
// lib.symbols.lineGetAgentStatusA(hLine, dwAddressID, lpAgentStatus)
// hLine : DWORD -> "u32"
// dwAddressID : DWORD -> "u32"
// lpAgentStatus : LINEAGENTSTATUS* in/out -> "pointer"
// 文字列は "buffer"。ANSI(-A) は new TextEncoder() で UTF-8/ANSI バイト列(末尾に \x00)を渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t lineGetAgentStatusA(
uint32_t hLine,
uint32_t dwAddressID,
void* lpAgentStatus);
C, "TAPI32.dll");
// $ffi->lineGetAgentStatusA(hLine, dwAddressID, lpAgentStatus);
// hLine : DWORD
// dwAddressID : DWORD
// lpAgentStatus : LINEAGENTSTATUS* 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 lineGetAgentStatusA(
int hLine, // DWORD
int dwAddressID, // DWORD
Pointer lpAgentStatus // LINEAGENTSTATUS* in/out
);
}@[Link("tapi32")]
lib LibTAPI32
fun lineGetAgentStatusA = lineGetAgentStatusA(
hLine : UInt32, # DWORD
dwAddressID : UInt32, # DWORD
lpAgentStatus : LINEAGENTSTATUS* # LINEAGENTSTATUS* 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 lineGetAgentStatusANative = Int32 Function(Uint32, Uint32, Pointer<Void>);
typedef lineGetAgentStatusADart = int Function(int, int, Pointer<Void>);
final lineGetAgentStatusA = DynamicLibrary.open('TAPI32.dll')
.lookupFunction<lineGetAgentStatusANative, lineGetAgentStatusADart>('lineGetAgentStatusA');
// hLine : DWORD -> Uint32
// dwAddressID : DWORD -> Uint32
// lpAgentStatus : LINEAGENTSTATUS* in/out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function lineGetAgentStatusA(
hLine: DWORD; // DWORD
dwAddressID: DWORD; // DWORD
lpAgentStatus: Pointer // LINEAGENTSTATUS* in/out
): Integer; stdcall;
external 'TAPI32.dll' name 'lineGetAgentStatusA';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "lineGetAgentStatusA"
c_lineGetAgentStatusA :: Word32 -> Word32 -> Ptr () -> IO Int32
-- hLine : DWORD -> Word32
-- dwAddressID : DWORD -> Word32
-- lpAgentStatus : LINEAGENTSTATUS* in/out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let linegetagentstatusa =
foreign "lineGetAgentStatusA"
(uint32_t @-> uint32_t @-> (ptr void) @-> returning int32_t)
(* hLine : DWORD -> uint32_t *)
(* dwAddressID : DWORD -> uint32_t *)
(* lpAgentStatus : LINEAGENTSTATUS* 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 ("lineGetAgentStatusA" line-get-agent-status-a :convention :stdcall) :int32
(h-line :uint32) ; DWORD
(dw-address-id :uint32) ; DWORD
(lp-agent-status :pointer)) ; LINEAGENTSTATUS* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $lineGetAgentStatusA = Win32::API::More->new('TAPI32',
'int lineGetAgentStatusA(DWORD hLine, DWORD dwAddressID, LPVOID lpAgentStatus)');
# my $ret = $lineGetAgentStatusA->Call($hLine, $dwAddressID, $lpAgentStatus);
# hLine : DWORD -> DWORD
# dwAddressID : DWORD -> DWORD
# lpAgentStatus : LINEAGENTSTATUS* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
文字セット違い
- f lineGetAgentStatusW (Unicode版) — アドレスのACDエージェントの現在の状態を取得する(Unicode版)。
使用する型