ホーム › Devices.Tapi › lineCreateAgentW
lineCreateAgentW
関数新しいACDエージェントオブジェクトを作成する(Unicode版)。
シグネチャ
// TAPI32.dll (Unicode / -W)
#include <windows.h>
INT lineCreateAgentW(
DWORD hLine,
LPCWSTR lpszAgentID, // optional
LPCWSTR lpszAgentPIN, // optional
DWORD* lphAgent
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hLine | DWORD | in |
| lpszAgentID | LPCWSTR | inoptional |
| lpszAgentPIN | LPCWSTR | inoptional |
| lphAgent | DWORD* | inout |
戻り値の型: INT
各言語での呼び出し定義
// TAPI32.dll (Unicode / -W)
#include <windows.h>
INT lineCreateAgentW(
DWORD hLine,
LPCWSTR lpszAgentID, // optional
LPCWSTR lpszAgentPIN, // optional
DWORD* lphAgent
);[DllImport("TAPI32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern int lineCreateAgentW(
uint hLine, // DWORD
[MarshalAs(UnmanagedType.LPWStr)] string lpszAgentID, // LPCWSTR optional
[MarshalAs(UnmanagedType.LPWStr)] string lpszAgentPIN, // LPCWSTR optional
ref uint lphAgent // DWORD* in/out
);<DllImport("TAPI32.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function lineCreateAgentW(
hLine As UInteger, ' DWORD
<MarshalAs(UnmanagedType.LPWStr)> lpszAgentID As String, ' LPCWSTR optional
<MarshalAs(UnmanagedType.LPWStr)> lpszAgentPIN As String, ' LPCWSTR optional
ByRef lphAgent As UInteger ' DWORD* in/out
) As Integer
End Function' hLine : DWORD
' lpszAgentID : LPCWSTR optional
' lpszAgentPIN : LPCWSTR optional
' lphAgent : DWORD* in/out
Declare PtrSafe Function lineCreateAgentW Lib "tapi32" ( _
ByVal hLine As Long, _
ByVal lpszAgentID As LongPtr, _
ByVal lpszAgentPIN As LongPtr, _
ByRef lphAgent 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
lineCreateAgentW = ctypes.windll.tapi32.lineCreateAgentW
lineCreateAgentW.restype = ctypes.c_int
lineCreateAgentW.argtypes = [
wintypes.DWORD, # hLine : DWORD
wintypes.LPCWSTR, # lpszAgentID : LPCWSTR optional
wintypes.LPCWSTR, # lpszAgentPIN : LPCWSTR optional
ctypes.POINTER(wintypes.DWORD), # lphAgent : DWORD* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('TAPI32.dll')
lineCreateAgentW = Fiddle::Function.new(
lib['lineCreateAgentW'],
[
-Fiddle::TYPE_INT, # hLine : DWORD
Fiddle::TYPE_VOIDP, # lpszAgentID : LPCWSTR optional
Fiddle::TYPE_VOIDP, # lpszAgentPIN : LPCWSTR optional
Fiddle::TYPE_VOIDP, # lphAgent : DWORD* in/out
],
Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "tapi32")]
extern "system" {
fn lineCreateAgentW(
hLine: u32, // DWORD
lpszAgentID: *const u16, // LPCWSTR optional
lpszAgentPIN: *const u16, // LPCWSTR optional
lphAgent: *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 lineCreateAgentW(uint hLine, [MarshalAs(UnmanagedType.LPWStr)] string lpszAgentID, [MarshalAs(UnmanagedType.LPWStr)] string lpszAgentPIN, ref uint lphAgent);
"@
$api = Add-Type -MemberDefinition $sig -Name 'TAPI32_lineCreateAgentW' -Namespace Win32 -PassThru
# $api::lineCreateAgentW(hLine, lpszAgentID, lpszAgentPIN, lphAgent)#uselib "TAPI32.dll"
#func global lineCreateAgentW "lineCreateAgentW" wptr, wptr, wptr, wptr
; lineCreateAgentW hLine, lpszAgentID, lpszAgentPIN, varptr(lphAgent) ; 戻り値は stat
; hLine : DWORD -> "wptr"
; lpszAgentID : LPCWSTR optional -> "wptr"
; lpszAgentPIN : LPCWSTR optional -> "wptr"
; lphAgent : DWORD* in/out -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "TAPI32.dll" #cfunc global lineCreateAgentW "lineCreateAgentW" int, wstr, wstr, var ; res = lineCreateAgentW(hLine, lpszAgentID, lpszAgentPIN, lphAgent) ; hLine : DWORD -> "int" ; lpszAgentID : LPCWSTR optional -> "wstr" ; lpszAgentPIN : LPCWSTR optional -> "wstr" ; lphAgent : DWORD* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "TAPI32.dll" #cfunc global lineCreateAgentW "lineCreateAgentW" int, wstr, wstr, sptr ; res = lineCreateAgentW(hLine, lpszAgentID, lpszAgentPIN, varptr(lphAgent)) ; hLine : DWORD -> "int" ; lpszAgentID : LPCWSTR optional -> "wstr" ; lpszAgentPIN : LPCWSTR optional -> "wstr" ; lphAgent : DWORD* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; INT lineCreateAgentW(DWORD hLine, LPCWSTR lpszAgentID, LPCWSTR lpszAgentPIN, DWORD* lphAgent) #uselib "TAPI32.dll" #cfunc global lineCreateAgentW "lineCreateAgentW" int, wstr, wstr, var ; res = lineCreateAgentW(hLine, lpszAgentID, lpszAgentPIN, lphAgent) ; hLine : DWORD -> "int" ; lpszAgentID : LPCWSTR optional -> "wstr" ; lpszAgentPIN : LPCWSTR optional -> "wstr" ; lphAgent : DWORD* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; INT lineCreateAgentW(DWORD hLine, LPCWSTR lpszAgentID, LPCWSTR lpszAgentPIN, DWORD* lphAgent) #uselib "TAPI32.dll" #cfunc global lineCreateAgentW "lineCreateAgentW" int, wstr, wstr, intptr ; res = lineCreateAgentW(hLine, lpszAgentID, lpszAgentPIN, varptr(lphAgent)) ; hLine : DWORD -> "int" ; lpszAgentID : LPCWSTR optional -> "wstr" ; lpszAgentPIN : LPCWSTR optional -> "wstr" ; lphAgent : DWORD* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
tapi32 = windows.NewLazySystemDLL("TAPI32.dll")
proclineCreateAgentW = tapi32.NewProc("lineCreateAgentW")
)
// hLine (DWORD), lpszAgentID (LPCWSTR optional), lpszAgentPIN (LPCWSTR optional), lphAgent (DWORD* in/out)
r1, _, err := proclineCreateAgentW.Call(
uintptr(hLine),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpszAgentID))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpszAgentPIN))),
uintptr(lphAgent),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction lineCreateAgentW(
hLine: DWORD; // DWORD
lpszAgentID: PWideChar; // LPCWSTR optional
lpszAgentPIN: PWideChar; // LPCWSTR optional
lphAgent: Pointer // DWORD* in/out
): Integer; stdcall;
external 'TAPI32.dll' name 'lineCreateAgentW';result := DllCall("TAPI32\lineCreateAgentW"
, "UInt", hLine ; DWORD
, "WStr", lpszAgentID ; LPCWSTR optional
, "WStr", lpszAgentPIN ; LPCWSTR optional
, "Ptr", lphAgent ; DWORD* in/out
, "Int") ; return: INT●lineCreateAgentW(hLine, lpszAgentID, lpszAgentPIN, lphAgent) = DLL("TAPI32.dll", "int lineCreateAgentW(dword, char*, char*, void*)")
# 呼び出し: lineCreateAgentW(hLine, lpszAgentID, lpszAgentPIN, lphAgent)
# hLine : DWORD -> "dword"
# lpszAgentID : LPCWSTR optional -> "char*"
# lpszAgentPIN : LPCWSTR optional -> "char*"
# lphAgent : DWORD* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。