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