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