Win32 API 日本語リファレンス
ホームDevices.Tapi › lineGetAgentInfo

lineGetAgentInfo

関数
指定したエージェントの情報を取得する。
DLLTAPI32.dll呼出規約winapi

シグネチャ

// TAPI32.dll
#include <windows.h>

INT lineGetAgentInfo(
    DWORD hLine,
    DWORD hAgent,
    LINEAGENTINFO* lpAgentInfo
);

パラメーター

名前方向
hLineDWORDin
hAgentDWORDin
lpAgentInfoLINEAGENTINFO*inout

戻り値の型: INT

各言語での呼び出し定義

// TAPI32.dll
#include <windows.h>

INT lineGetAgentInfo(
    DWORD hLine,
    DWORD hAgent,
    LINEAGENTINFO* lpAgentInfo
);
[DllImport("TAPI32.dll", ExactSpelling = true)]
static extern int lineGetAgentInfo(
    uint hLine,   // DWORD
    uint hAgent,   // DWORD
    IntPtr lpAgentInfo   // LINEAGENTINFO* in/out
);
<DllImport("TAPI32.dll", ExactSpelling:=True)>
Public Shared Function lineGetAgentInfo(
    hLine As UInteger,   ' DWORD
    hAgent As UInteger,   ' DWORD
    lpAgentInfo As IntPtr   ' LINEAGENTINFO* in/out
) As Integer
End Function
' hLine : DWORD
' hAgent : DWORD
' lpAgentInfo : LINEAGENTINFO* in/out
Declare PtrSafe Function lineGetAgentInfo Lib "tapi32" ( _
    ByVal hLine As Long, _
    ByVal hAgent As Long, _
    ByVal lpAgentInfo As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

lineGetAgentInfo = ctypes.windll.tapi32.lineGetAgentInfo
lineGetAgentInfo.restype = ctypes.c_int
lineGetAgentInfo.argtypes = [
    wintypes.DWORD,  # hLine : DWORD
    wintypes.DWORD,  # hAgent : DWORD
    ctypes.c_void_p,  # lpAgentInfo : LINEAGENTINFO* in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	tapi32 = windows.NewLazySystemDLL("TAPI32.dll")
	proclineGetAgentInfo = tapi32.NewProc("lineGetAgentInfo")
)

// hLine (DWORD), hAgent (DWORD), lpAgentInfo (LINEAGENTINFO* in/out)
r1, _, err := proclineGetAgentInfo.Call(
	uintptr(hLine),
	uintptr(hAgent),
	uintptr(lpAgentInfo),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // INT
function lineGetAgentInfo(
  hLine: DWORD;   // DWORD
  hAgent: DWORD;   // DWORD
  lpAgentInfo: Pointer   // LINEAGENTINFO* in/out
): Integer; stdcall;
  external 'TAPI32.dll' name 'lineGetAgentInfo';
result := DllCall("TAPI32\lineGetAgentInfo"
    , "UInt", hLine   ; DWORD
    , "UInt", hAgent   ; DWORD
    , "Ptr", lpAgentInfo   ; LINEAGENTINFO* in/out
    , "Int")   ; return: INT
●lineGetAgentInfo(hLine, hAgent, lpAgentInfo) = DLL("TAPI32.dll", "int lineGetAgentInfo(dword, dword, void*)")
# 呼び出し: lineGetAgentInfo(hLine, hAgent, lpAgentInfo)
# hLine : DWORD -> "dword"
# hAgent : DWORD -> "dword"
# lpAgentInfo : LINEAGENTINFO* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。