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

lineGetAgentSessionInfo

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

シグネチャ

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

INT lineGetAgentSessionInfo(
    DWORD hLine,
    DWORD hAgentSession,
    LINEAGENTSESSIONINFO* lpAgentSessionInfo
);

パラメーター

名前方向説明
hLineDWORDin対象の回線デバイスハンドル。
hAgentSessionDWORDin情報を取得するエージェントセッションのハンドル。
lpAgentSessionInfoLINEAGENTSESSIONINFO*inoutセッション情報を受け取るLINEAGENTSESSIONINFOへのポインタ。

戻り値の型: INT

各言語での呼び出し定義

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

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

lineGetAgentSessionInfo = ctypes.windll.tapi32.lineGetAgentSessionInfo
lineGetAgentSessionInfo.restype = ctypes.c_int
lineGetAgentSessionInfo.argtypes = [
    wintypes.DWORD,  # hLine : DWORD
    wintypes.DWORD,  # hAgentSession : DWORD
    ctypes.c_void_p,  # lpAgentSessionInfo : LINEAGENTSESSIONINFO* in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	tapi32 = windows.NewLazySystemDLL("TAPI32.dll")
	proclineGetAgentSessionInfo = tapi32.NewProc("lineGetAgentSessionInfo")
)

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

extern "tapi32" fn lineGetAgentSessionInfo(
    hLine: u32, // DWORD
    hAgentSession: u32, // DWORD
    lpAgentSessionInfo: [*c]LINEAGENTSESSIONINFO // LINEAGENTSESSIONINFO* in/out
) callconv(std.os.windows.WINAPI) i32;
proc lineGetAgentSessionInfo(
    hLine: uint32,  # DWORD
    hAgentSession: uint32,  # DWORD
    lpAgentSessionInfo: ptr LINEAGENTSESSIONINFO  # LINEAGENTSESSIONINFO* in/out
): int32 {.importc: "lineGetAgentSessionInfo", stdcall, dynlib: "TAPI32.dll".}
pragma(lib, "tapi32");
extern(Windows)
int lineGetAgentSessionInfo(
    uint hLine,   // DWORD
    uint hAgentSession,   // DWORD
    LINEAGENTSESSIONINFO* lpAgentSessionInfo   // LINEAGENTSESSIONINFO* in/out
);
ccall((:lineGetAgentSessionInfo, "TAPI32.dll"), stdcall, Int32,
      (UInt32, UInt32, Ptr{LINEAGENTSESSIONINFO}),
      hLine, hAgentSession, lpAgentSessionInfo)
# hLine : DWORD -> UInt32
# hAgentSession : DWORD -> UInt32
# lpAgentSessionInfo : LINEAGENTSESSIONINFO* in/out -> Ptr{LINEAGENTSESSIONINFO}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t lineGetAgentSessionInfo(
    uint32_t hLine,
    uint32_t hAgentSession,
    void* lpAgentSessionInfo);
]]
local tapi32 = ffi.load("tapi32")
-- tapi32.lineGetAgentSessionInfo(hLine, hAgentSession, lpAgentSessionInfo)
-- hLine : DWORD
-- hAgentSession : DWORD
-- lpAgentSessionInfo : LINEAGENTSESSIONINFO* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('TAPI32.dll');
const lineGetAgentSessionInfo = lib.func('__stdcall', 'lineGetAgentSessionInfo', 'int32_t', ['uint32_t', 'uint32_t', 'void *']);
// lineGetAgentSessionInfo(hLine, hAgentSession, lpAgentSessionInfo)
// hLine : DWORD -> 'uint32_t'
// hAgentSession : DWORD -> 'uint32_t'
// lpAgentSessionInfo : LINEAGENTSESSIONINFO* in/out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("TAPI32.dll", {
  lineGetAgentSessionInfo: { parameters: ["u32", "u32", "pointer"], result: "i32" },
});
// lib.symbols.lineGetAgentSessionInfo(hLine, hAgentSession, lpAgentSessionInfo)
// hLine : DWORD -> "u32"
// hAgentSession : DWORD -> "u32"
// lpAgentSessionInfo : LINEAGENTSESSIONINFO* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t lineGetAgentSessionInfo(
    uint32_t hLine,
    uint32_t hAgentSession,
    void* lpAgentSessionInfo);
C, "TAPI32.dll");
// $ffi->lineGetAgentSessionInfo(hLine, hAgentSession, lpAgentSessionInfo);
// hLine : DWORD
// hAgentSession : DWORD
// lpAgentSessionInfo : LINEAGENTSESSIONINFO* 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);
    int lineGetAgentSessionInfo(
        int hLine,   // DWORD
        int hAgentSession,   // DWORD
        Pointer lpAgentSessionInfo   // LINEAGENTSESSIONINFO* in/out
    );
}
@[Link("tapi32")]
lib LibTAPI32
  fun lineGetAgentSessionInfo = lineGetAgentSessionInfo(
    hLine : UInt32,   # DWORD
    hAgentSession : UInt32,   # DWORD
    lpAgentSessionInfo : LINEAGENTSESSIONINFO*   # LINEAGENTSESSIONINFO* 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 lineGetAgentSessionInfoNative = Int32 Function(Uint32, Uint32, Pointer<Void>);
typedef lineGetAgentSessionInfoDart = int Function(int, int, Pointer<Void>);
final lineGetAgentSessionInfo = DynamicLibrary.open('TAPI32.dll')
    .lookupFunction<lineGetAgentSessionInfoNative, lineGetAgentSessionInfoDart>('lineGetAgentSessionInfo');
// hLine : DWORD -> Uint32
// hAgentSession : DWORD -> Uint32
// lpAgentSessionInfo : LINEAGENTSESSIONINFO* in/out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function lineGetAgentSessionInfo(
  hLine: DWORD;   // DWORD
  hAgentSession: DWORD;   // DWORD
  lpAgentSessionInfo: Pointer   // LINEAGENTSESSIONINFO* in/out
): Integer; stdcall;
  external 'TAPI32.dll' name 'lineGetAgentSessionInfo';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "lineGetAgentSessionInfo"
  c_lineGetAgentSessionInfo :: Word32 -> Word32 -> Ptr () -> IO Int32
-- hLine : DWORD -> Word32
-- hAgentSession : DWORD -> Word32
-- lpAgentSessionInfo : LINEAGENTSESSIONINFO* in/out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let linegetagentsessioninfo =
  foreign "lineGetAgentSessionInfo"
    (uint32_t @-> uint32_t @-> (ptr void) @-> returning int32_t)
(* hLine : DWORD -> uint32_t *)
(* hAgentSession : DWORD -> uint32_t *)
(* lpAgentSessionInfo : LINEAGENTSESSIONINFO* 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 ("lineGetAgentSessionInfo" line-get-agent-session-info :convention :stdcall) :int32
  (h-line :uint32)   ; DWORD
  (h-agent-session :uint32)   ; DWORD
  (lp-agent-session-info :pointer))   ; LINEAGENTSESSIONINFO* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $lineGetAgentSessionInfo = Win32::API::More->new('TAPI32',
    'int lineGetAgentSessionInfo(DWORD hLine, DWORD hAgentSession, LPVOID lpAgentSessionInfo)');
# my $ret = $lineGetAgentSessionInfo->Call($hLine, $hAgentSession, $lpAgentSessionInfo);
# hLine : DWORD -> DWORD
# hAgentSession : DWORD -> DWORD
# lpAgentSessionInfo : LINEAGENTSESSIONINFO* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型