ホーム › Devices.Tapi › linePickupA
linePickupA
関数他で保留・着信中の通話を取得して応答する(ANSI版)。
シグネチャ
// TAPI32.dll (ANSI / -A)
#include <windows.h>
INT linePickupA(
DWORD hLine,
DWORD dwAddressID,
DWORD* lphCall,
LPCSTR lpszDestAddress,
LPCSTR lpszGroupID
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hLine | DWORD | in | 通話を取り上げる対象の開いた回線のハンドル。 |
| dwAddressID | DWORD | in | 取り上げに使用する0起点のアドレスID。 |
| lphCall | DWORD* | inout | 取り上げた通話のハンドルを受け取るDWORDへのポインタ。 |
| lpszDestAddress | LPCSTR | in | 取り上げ対象の鳴動中アドレスを示すANSI文字列。NULL可。 |
| lpszGroupID | LPCSTR | in | ピックアップグループのIDを示すANSI文字列。NULL可。 |
戻り値の型: INT
各言語での呼び出し定義
// TAPI32.dll (ANSI / -A)
#include <windows.h>
INT linePickupA(
DWORD hLine,
DWORD dwAddressID,
DWORD* lphCall,
LPCSTR lpszDestAddress,
LPCSTR lpszGroupID
);[DllImport("TAPI32.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern int linePickupA(
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 linePickupA(
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 linePickupA 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
linePickupA = ctypes.windll.tapi32.linePickupA
linePickupA.restype = ctypes.c_int
linePickupA.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')
linePickupA = Fiddle::Function.new(
lib['linePickupA'],
[
-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 linePickupA(
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 linePickupA(uint hLine, uint dwAddressID, ref uint lphCall, [MarshalAs(UnmanagedType.LPStr)] string lpszDestAddress, [MarshalAs(UnmanagedType.LPStr)] string lpszGroupID);
"@
$api = Add-Type -MemberDefinition $sig -Name 'TAPI32_linePickupA' -Namespace Win32 -PassThru
# $api::linePickupA(hLine, dwAddressID, lphCall, lpszDestAddress, lpszGroupID)#uselib "TAPI32.dll"
#func global linePickupA "linePickupA" sptr, sptr, sptr, sptr, sptr
; linePickupA 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 linePickupA "linePickupA" int, int, var, str, str ; res = linePickupA(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 linePickupA "linePickupA" int, int, sptr, str, str ; res = linePickupA(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 linePickupA(DWORD hLine, DWORD dwAddressID, DWORD* lphCall, LPCSTR lpszDestAddress, LPCSTR lpszGroupID) #uselib "TAPI32.dll" #cfunc global linePickupA "linePickupA" int, int, var, str, str ; res = linePickupA(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 linePickupA(DWORD hLine, DWORD dwAddressID, DWORD* lphCall, LPCSTR lpszDestAddress, LPCSTR lpszGroupID) #uselib "TAPI32.dll" #cfunc global linePickupA "linePickupA" int, int, intptr, str, str ; res = linePickupA(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")
proclinePickupA = tapi32.NewProc("linePickupA")
)
// hLine (DWORD), dwAddressID (DWORD), lphCall (DWORD* in/out), lpszDestAddress (LPCSTR), lpszGroupID (LPCSTR)
r1, _, err := proclinePickupA.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 linePickupA(
hLine: DWORD; // DWORD
dwAddressID: DWORD; // DWORD
lphCall: Pointer; // DWORD* in/out
lpszDestAddress: PAnsiChar; // LPCSTR
lpszGroupID: PAnsiChar // LPCSTR
): Integer; stdcall;
external 'TAPI32.dll' name 'linePickupA';result := DllCall("TAPI32\linePickupA"
, "UInt", hLine ; DWORD
, "UInt", dwAddressID ; DWORD
, "Ptr", lphCall ; DWORD* in/out
, "AStr", lpszDestAddress ; LPCSTR
, "AStr", lpszGroupID ; LPCSTR
, "Int") ; return: INT●linePickupA(hLine, dwAddressID, lphCall, lpszDestAddress, lpszGroupID) = DLL("TAPI32.dll", "int linePickupA(dword, dword, void*, char*, char*)")
# 呼び出し: linePickupA(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)。const std = @import("std");
extern "tapi32" fn linePickupA(
hLine: u32, // DWORD
dwAddressID: u32, // DWORD
lphCall: [*c]u32, // DWORD* in/out
lpszDestAddress: [*c]const u8, // LPCSTR
lpszGroupID: [*c]const u8 // LPCSTR
) callconv(std.os.windows.WINAPI) i32;proc linePickupA(
hLine: uint32, # DWORD
dwAddressID: uint32, # DWORD
lphCall: ptr uint32, # DWORD* in/out
lpszDestAddress: cstring, # LPCSTR
lpszGroupID: cstring # LPCSTR
): int32 {.importc: "linePickupA", stdcall, dynlib: "TAPI32.dll".}pragma(lib, "tapi32");
extern(Windows)
int linePickupA(
uint hLine, // DWORD
uint dwAddressID, // DWORD
uint* lphCall, // DWORD* in/out
const(char)* lpszDestAddress, // LPCSTR
const(char)* lpszGroupID // LPCSTR
);ccall((:linePickupA, "TAPI32.dll"), stdcall, Int32,
(UInt32, UInt32, Ptr{UInt32}, Cstring, Cstring),
hLine, dwAddressID, lphCall, lpszDestAddress, lpszGroupID)
# hLine : DWORD -> UInt32
# dwAddressID : DWORD -> UInt32
# lphCall : DWORD* in/out -> Ptr{UInt32}
# lpszDestAddress : LPCSTR -> Cstring
# lpszGroupID : LPCSTR -> Cstring
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t linePickupA(
uint32_t hLine,
uint32_t dwAddressID,
uint32_t* lphCall,
const char* lpszDestAddress,
const char* lpszGroupID);
]]
local tapi32 = ffi.load("tapi32")
-- tapi32.linePickupA(hLine, dwAddressID, lphCall, lpszDestAddress, lpszGroupID)
-- hLine : DWORD
-- dwAddressID : DWORD
-- lphCall : DWORD* in/out
-- lpszDestAddress : LPCSTR
-- lpszGroupID : LPCSTR
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('TAPI32.dll');
const linePickupA = lib.func('__stdcall', 'linePickupA', 'int32_t', ['uint32_t', 'uint32_t', 'uint32_t *', 'str', 'str']);
// linePickupA(hLine, dwAddressID, lphCall, lpszDestAddress, lpszGroupID)
// hLine : DWORD -> 'uint32_t'
// dwAddressID : DWORD -> 'uint32_t'
// lphCall : DWORD* in/out -> 'uint32_t *'
// lpszDestAddress : LPCSTR -> 'str'
// lpszGroupID : LPCSTR -> 'str'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("TAPI32.dll", {
linePickupA: { parameters: ["u32", "u32", "pointer", "buffer", "buffer"], result: "i32" },
});
// lib.symbols.linePickupA(hLine, dwAddressID, lphCall, lpszDestAddress, lpszGroupID)
// hLine : DWORD -> "u32"
// dwAddressID : DWORD -> "u32"
// lphCall : DWORD* in/out -> "pointer"
// lpszDestAddress : LPCSTR -> "buffer"
// lpszGroupID : LPCSTR -> "buffer"
// 文字列は "buffer"。ANSI(-A) は new TextEncoder() で UTF-8/ANSI バイト列(末尾に \x00)を渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t linePickupA(
uint32_t hLine,
uint32_t dwAddressID,
uint32_t* lphCall,
const char* lpszDestAddress,
const char* lpszGroupID);
C, "TAPI32.dll");
// $ffi->linePickupA(hLine, dwAddressID, lphCall, lpszDestAddress, lpszGroupID);
// hLine : DWORD
// dwAddressID : DWORD
// lphCall : DWORD* in/out
// lpszDestAddress : LPCSTR
// lpszGroupID : LPCSTR
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Tapi32 extends StdCallLibrary {
Tapi32 INSTANCE = Native.load("tapi32", Tapi32.class, W32APIOptions.ASCII_OPTIONS);
int linePickupA(
int hLine, // DWORD
int dwAddressID, // DWORD
IntByReference lphCall, // DWORD* in/out
String lpszDestAddress, // LPCSTR
String lpszGroupID // LPCSTR
);
}@[Link("tapi32")]
lib LibTAPI32
fun linePickupA = linePickupA(
hLine : UInt32, # DWORD
dwAddressID : UInt32, # DWORD
lphCall : UInt32*, # DWORD* in/out
lpszDestAddress : UInt8*, # LPCSTR
lpszGroupID : UInt8* # LPCSTR
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef linePickupANative = Int32 Function(Uint32, Uint32, Pointer<Uint32>, Pointer<Utf8>, Pointer<Utf8>);
typedef linePickupADart = int Function(int, int, Pointer<Uint32>, Pointer<Utf8>, Pointer<Utf8>);
final linePickupA = DynamicLibrary.open('TAPI32.dll')
.lookupFunction<linePickupANative, linePickupADart>('linePickupA');
// hLine : DWORD -> Uint32
// dwAddressID : DWORD -> Uint32
// lphCall : DWORD* in/out -> Pointer<Uint32>
// lpszDestAddress : LPCSTR -> Pointer<Utf8>
// lpszGroupID : LPCSTR -> Pointer<Utf8>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function linePickupA(
hLine: DWORD; // DWORD
dwAddressID: DWORD; // DWORD
lphCall: Pointer; // DWORD* in/out
lpszDestAddress: PAnsiChar; // LPCSTR
lpszGroupID: PAnsiChar // LPCSTR
): Integer; stdcall;
external 'TAPI32.dll' name 'linePickupA';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "linePickupA"
c_linePickupA :: Word32 -> Word32 -> Ptr Word32 -> CString -> CString -> IO Int32
-- hLine : DWORD -> Word32
-- dwAddressID : DWORD -> Word32
-- lphCall : DWORD* in/out -> Ptr Word32
-- lpszDestAddress : LPCSTR -> CString
-- lpszGroupID : LPCSTR -> CString
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let linepickupa =
foreign "linePickupA"
(uint32_t @-> uint32_t @-> (ptr uint32_t) @-> string @-> string @-> returning int32_t)
(* hLine : DWORD -> uint32_t *)
(* dwAddressID : DWORD -> uint32_t *)
(* lphCall : DWORD* in/out -> (ptr uint32_t) *)
(* lpszDestAddress : LPCSTR -> string *)
(* lpszGroupID : LPCSTR -> string *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library tapi32 (t "TAPI32.dll"))
(cffi:use-foreign-library tapi32)
(cffi:defcfun ("linePickupA" line-pickup-a :convention :stdcall) :int32
(h-line :uint32) ; DWORD
(dw-address-id :uint32) ; DWORD
(lph-call :pointer) ; DWORD* in/out
(lpsz-dest-address :string) ; LPCSTR
(lpsz-group-id :string)) ; LPCSTR
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $linePickupA = Win32::API::More->new('TAPI32',
'int linePickupA(DWORD hLine, DWORD dwAddressID, LPVOID lphCall, LPCSTR lpszDestAddress, LPCSTR lpszGroupID)');
# my $ret = $linePickupA->Call($hLine, $dwAddressID, $lphCall, $lpszDestAddress, $lpszGroupID);
# hLine : DWORD -> DWORD
# dwAddressID : DWORD -> DWORD
# lphCall : DWORD* in/out -> LPVOID
# lpszDestAddress : LPCSTR -> LPCSTR
# lpszGroupID : LPCSTR -> LPCSTR
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
文字セット違い
- f linePickupW (Unicode版) — 他で保留・着信中の通話を取得して応答する(Unicode版)。