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

lineCreateAgentSessionW

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

シグネチャ

// TAPI32.dll  (Unicode / -W)
#include <windows.h>

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

パラメーター

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

戻り値の型: INT

各言語での呼び出し定義

// TAPI32.dll  (Unicode / -W)
#include <windows.h>

INT lineCreateAgentSessionW(
    DWORD hLine,
    DWORD hAgent,
    LPCWSTR lpszAgentPIN,   // optional
    DWORD dwWorkingAddressID,
    GUID* lpGroupID,
    DWORD* lphAgentSession
);
[DllImport("TAPI32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern int lineCreateAgentSessionW(
    uint hLine,   // DWORD
    uint hAgent,   // DWORD
    [MarshalAs(UnmanagedType.LPWStr)] string lpszAgentPIN,   // LPCWSTR optional
    uint dwWorkingAddressID,   // DWORD
    ref Guid lpGroupID,   // GUID* in/out
    ref uint lphAgentSession   // DWORD* in/out
);
<DllImport("TAPI32.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function lineCreateAgentSessionW(
    hLine As UInteger,   ' DWORD
    hAgent As UInteger,   ' DWORD
    <MarshalAs(UnmanagedType.LPWStr)> lpszAgentPIN As String,   ' LPCWSTR 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 : LPCWSTR optional
' dwWorkingAddressID : DWORD
' lpGroupID : GUID* in/out
' lphAgentSession : DWORD* in/out
Declare PtrSafe Function lineCreateAgentSessionW Lib "tapi32" ( _
    ByVal hLine As Long, _
    ByVal hAgent As Long, _
    ByVal lpszAgentPIN As LongPtr, _
    ByVal dwWorkingAddressID As Long, _
    ByVal lpGroupID As LongPtr, _
    ByRef lphAgentSession As Long) As Long
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

lineCreateAgentSessionW = ctypes.windll.tapi32.lineCreateAgentSessionW
lineCreateAgentSessionW.restype = ctypes.c_int
lineCreateAgentSessionW.argtypes = [
    wintypes.DWORD,  # hLine : DWORD
    wintypes.DWORD,  # hAgent : DWORD
    wintypes.LPCWSTR,  # lpszAgentPIN : LPCWSTR 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')
lineCreateAgentSessionW = Fiddle::Function.new(
  lib['lineCreateAgentSessionW'],
  [
    -Fiddle::TYPE_INT,  # hLine : DWORD
    -Fiddle::TYPE_INT,  # hAgent : DWORD
    Fiddle::TYPE_VOIDP,  # lpszAgentPIN : LPCWSTR optional
    -Fiddle::TYPE_INT,  # dwWorkingAddressID : DWORD
    Fiddle::TYPE_VOIDP,  # lpGroupID : GUID* in/out
    Fiddle::TYPE_VOIDP,  # lphAgentSession : DWORD* in/out
  ],
  Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "tapi32")]
extern "system" {
    fn lineCreateAgentSessionW(
        hLine: u32,  // DWORD
        hAgent: u32,  // DWORD
        lpszAgentPIN: *const u16,  // LPCWSTR 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.Unicode)]
public static extern int lineCreateAgentSessionW(uint hLine, uint hAgent, [MarshalAs(UnmanagedType.LPWStr)] string lpszAgentPIN, uint dwWorkingAddressID, ref Guid lpGroupID, ref uint lphAgentSession);
"@
$api = Add-Type -MemberDefinition $sig -Name 'TAPI32_lineCreateAgentSessionW' -Namespace Win32 -PassThru
# $api::lineCreateAgentSessionW(hLine, hAgent, lpszAgentPIN, dwWorkingAddressID, lpGroupID, lphAgentSession)
#uselib "TAPI32.dll"
#func global lineCreateAgentSessionW "lineCreateAgentSessionW" wptr, wptr, wptr, wptr, wptr, wptr
; lineCreateAgentSessionW hLine, hAgent, lpszAgentPIN, dwWorkingAddressID, varptr(lpGroupID), varptr(lphAgentSession)   ; 戻り値は stat
; hLine : DWORD -> "wptr"
; hAgent : DWORD -> "wptr"
; lpszAgentPIN : LPCWSTR optional -> "wptr"
; dwWorkingAddressID : DWORD -> "wptr"
; lpGroupID : GUID* in/out -> "wptr"
; lphAgentSession : DWORD* in/out -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "TAPI32.dll"
#cfunc global lineCreateAgentSessionW "lineCreateAgentSessionW" int, int, wstr, int, var, var
; res = lineCreateAgentSessionW(hLine, hAgent, lpszAgentPIN, dwWorkingAddressID, lpGroupID, lphAgentSession)
; hLine : DWORD -> "int"
; hAgent : DWORD -> "int"
; lpszAgentPIN : LPCWSTR optional -> "wstr"
; dwWorkingAddressID : DWORD -> "int"
; lpGroupID : GUID* in/out -> "var"
; lphAgentSession : DWORD* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; INT lineCreateAgentSessionW(DWORD hLine, DWORD hAgent, LPCWSTR lpszAgentPIN, DWORD dwWorkingAddressID, GUID* lpGroupID, DWORD* lphAgentSession)
#uselib "TAPI32.dll"
#cfunc global lineCreateAgentSessionW "lineCreateAgentSessionW" int, int, wstr, int, var, var
; res = lineCreateAgentSessionW(hLine, hAgent, lpszAgentPIN, dwWorkingAddressID, lpGroupID, lphAgentSession)
; hLine : DWORD -> "int"
; hAgent : DWORD -> "int"
; lpszAgentPIN : LPCWSTR optional -> "wstr"
; 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")
	proclineCreateAgentSessionW = tapi32.NewProc("lineCreateAgentSessionW")
)

// hLine (DWORD), hAgent (DWORD), lpszAgentPIN (LPCWSTR optional), dwWorkingAddressID (DWORD), lpGroupID (GUID* in/out), lphAgentSession (DWORD* in/out)
r1, _, err := proclineCreateAgentSessionW.Call(
	uintptr(hLine),
	uintptr(hAgent),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpszAgentPIN))),
	uintptr(dwWorkingAddressID),
	uintptr(lpGroupID),
	uintptr(lphAgentSession),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // INT
function lineCreateAgentSessionW(
  hLine: DWORD;   // DWORD
  hAgent: DWORD;   // DWORD
  lpszAgentPIN: PWideChar;   // LPCWSTR optional
  dwWorkingAddressID: DWORD;   // DWORD
  lpGroupID: PGUID;   // GUID* in/out
  lphAgentSession: Pointer   // DWORD* in/out
): Integer; stdcall;
  external 'TAPI32.dll' name 'lineCreateAgentSessionW';
result := DllCall("TAPI32\lineCreateAgentSessionW"
    , "UInt", hLine   ; DWORD
    , "UInt", hAgent   ; DWORD
    , "WStr", lpszAgentPIN   ; LPCWSTR optional
    , "UInt", dwWorkingAddressID   ; DWORD
    , "Ptr", lpGroupID   ; GUID* in/out
    , "Ptr", lphAgentSession   ; DWORD* in/out
    , "Int")   ; return: INT
●lineCreateAgentSessionW(hLine, hAgent, lpszAgentPIN, dwWorkingAddressID, lpGroupID, lphAgentSession) = DLL("TAPI32.dll", "int lineCreateAgentSessionW(dword, dword, char*, dword, void*, void*)")
# 呼び出し: lineCreateAgentSessionW(hLine, hAgent, lpszAgentPIN, dwWorkingAddressID, lpGroupID, lphAgentSession)
# hLine : DWORD -> "dword"
# hAgent : DWORD -> "dword"
# lpszAgentPIN : LPCWSTR optional -> "char*"
# dwWorkingAddressID : DWORD -> "dword"
# lpGroupID : GUID* in/out -> "void*"
# lphAgentSession : DWORD* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。