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