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

lineCreateAgentSessionA

関数
エージェントのセッションを作成しグループに関連付ける(ANSI版)。
DLLTAPI32.dll文字セットANSI (-A)呼出規約winapi

シグネチャ

// TAPI32.dll  (ANSI / -A)
#include <windows.h>

INT lineCreateAgentSessionA(
    DWORD hLine,
    DWORD hAgent,
    LPCSTR lpszAgentPIN,   // optional
    DWORD dwWorkingAddressID,
    GUID* lpGroupID,
    DWORD* lphAgentSession
);

パラメーター

名前方向
hLineDWORDin
hAgentDWORDin
lpszAgentPINLPCSTRinoptional
dwWorkingAddressIDDWORDin
lpGroupIDGUID*inout
lphAgentSessionDWORD*inout

戻り値の型: INT

各言語での呼び出し定義

// TAPI32.dll  (ANSI / -A)
#include <windows.h>

INT lineCreateAgentSessionA(
    DWORD hLine,
    DWORD hAgent,
    LPCSTR lpszAgentPIN,   // optional
    DWORD dwWorkingAddressID,
    GUID* lpGroupID,
    DWORD* lphAgentSession
);
[DllImport("TAPI32.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern int lineCreateAgentSessionA(
    uint hLine,   // DWORD
    uint hAgent,   // DWORD
    [MarshalAs(UnmanagedType.LPStr)] string lpszAgentPIN,   // LPCSTR optional
    uint dwWorkingAddressID,   // DWORD
    ref Guid lpGroupID,   // GUID* in/out
    ref uint lphAgentSession   // DWORD* in/out
);
<DllImport("TAPI32.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function lineCreateAgentSessionA(
    hLine As UInteger,   ' DWORD
    hAgent As UInteger,   ' DWORD
    <MarshalAs(UnmanagedType.LPStr)> lpszAgentPIN As String,   ' LPCSTR optional
    dwWorkingAddressID As UInteger,   ' DWORD
    ByRef lpGroupID As Guid,   ' GUID* in/out
    ByRef lphAgentSession As UInteger   ' DWORD* in/out
) As Integer
End Function
' hLine : DWORD
' hAgent : DWORD
' lpszAgentPIN : LPCSTR optional
' dwWorkingAddressID : DWORD
' lpGroupID : GUID* in/out
' lphAgentSession : DWORD* in/out
Declare PtrSafe Function lineCreateAgentSessionA Lib "tapi32" ( _
    ByVal hLine As Long, _
    ByVal hAgent As Long, _
    ByVal lpszAgentPIN As String, _
    ByVal dwWorkingAddressID As Long, _
    ByVal lpGroupID As LongPtr, _
    ByRef lphAgentSession As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

lineCreateAgentSessionA = ctypes.windll.tapi32.lineCreateAgentSessionA
lineCreateAgentSessionA.restype = ctypes.c_int
lineCreateAgentSessionA.argtypes = [
    wintypes.DWORD,  # hLine : DWORD
    wintypes.DWORD,  # hAgent : DWORD
    wintypes.LPCSTR,  # lpszAgentPIN : LPCSTR optional
    wintypes.DWORD,  # dwWorkingAddressID : DWORD
    ctypes.c_void_p,  # lpGroupID : GUID* in/out
    ctypes.POINTER(wintypes.DWORD),  # lphAgentSession : DWORD* in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	tapi32 = windows.NewLazySystemDLL("TAPI32.dll")
	proclineCreateAgentSessionA = tapi32.NewProc("lineCreateAgentSessionA")
)

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