ホーム › Devices.Tapi › lineMakeCallA
lineMakeCallA
関数指定アドレスへ発信して新しい通話を開始する(ANSI版)。
シグネチャ
// TAPI32.dll (ANSI / -A)
#include <windows.h>
INT lineMakeCallA(
DWORD hLine,
DWORD* lphCall,
LPCSTR lpszDestAddress,
DWORD dwCountryCode,
const LINECALLPARAMS* lpCallParams
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hLine | DWORD | in | 発信に使用する開いた回線のハンドル。 |
| lphCall | DWORD* | inout | 新規発信通話のハンドルを受け取るDWORDへのポインタ。 |
| lpszDestAddress | LPCSTR | in | 発信先アドレス(電話番号等)を示すANSI文字列。NULL可で番号未指定の発信となる。 |
| dwCountryCode | DWORD | in | 発信先の国番号。トーン選択等に用い、0で既定値を使用する。 |
| lpCallParams | LINECALLPARAMS* | in | 発信時の通話パラメータを指定するLINECALLPARAMS構造体へのポインタ。NULL可で既定値となる。 |
戻り値の型: INT
各言語での呼び出し定義
// TAPI32.dll (ANSI / -A)
#include <windows.h>
INT lineMakeCallA(
DWORD hLine,
DWORD* lphCall,
LPCSTR lpszDestAddress,
DWORD dwCountryCode,
const LINECALLPARAMS* lpCallParams
);[DllImport("TAPI32.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern int lineMakeCallA(
uint hLine, // DWORD
ref uint lphCall, // DWORD* in/out
[MarshalAs(UnmanagedType.LPStr)] string lpszDestAddress, // LPCSTR
uint dwCountryCode, // DWORD
IntPtr lpCallParams // LINECALLPARAMS*
);<DllImport("TAPI32.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function lineMakeCallA(
hLine As UInteger, ' DWORD
ByRef lphCall As UInteger, ' DWORD* in/out
<MarshalAs(UnmanagedType.LPStr)> lpszDestAddress As String, ' LPCSTR
dwCountryCode As UInteger, ' DWORD
lpCallParams As IntPtr ' LINECALLPARAMS*
) As Integer
End Function' hLine : DWORD
' lphCall : DWORD* in/out
' lpszDestAddress : LPCSTR
' dwCountryCode : DWORD
' lpCallParams : LINECALLPARAMS*
Declare PtrSafe Function lineMakeCallA Lib "tapi32" ( _
ByVal hLine As Long, _
ByRef lphCall As Long, _
ByVal lpszDestAddress As String, _
ByVal dwCountryCode As Long, _
ByVal lpCallParams As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
lineMakeCallA = ctypes.windll.tapi32.lineMakeCallA
lineMakeCallA.restype = ctypes.c_int
lineMakeCallA.argtypes = [
wintypes.DWORD, # hLine : DWORD
ctypes.POINTER(wintypes.DWORD), # lphCall : DWORD* in/out
wintypes.LPCSTR, # lpszDestAddress : LPCSTR
wintypes.DWORD, # dwCountryCode : DWORD
ctypes.c_void_p, # lpCallParams : LINECALLPARAMS*
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('TAPI32.dll')
lineMakeCallA = Fiddle::Function.new(
lib['lineMakeCallA'],
[
-Fiddle::TYPE_INT, # hLine : DWORD
Fiddle::TYPE_VOIDP, # lphCall : DWORD* in/out
Fiddle::TYPE_VOIDP, # lpszDestAddress : LPCSTR
-Fiddle::TYPE_INT, # dwCountryCode : DWORD
Fiddle::TYPE_VOIDP, # lpCallParams : LINECALLPARAMS*
],
Fiddle::TYPE_INT)#[link(name = "tapi32")]
extern "system" {
fn lineMakeCallA(
hLine: u32, // DWORD
lphCall: *mut u32, // DWORD* in/out
lpszDestAddress: *const u8, // LPCSTR
dwCountryCode: u32, // DWORD
lpCallParams: *const LINECALLPARAMS // LINECALLPARAMS*
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("TAPI32.dll", CharSet = CharSet.Ansi)]
public static extern int lineMakeCallA(uint hLine, ref uint lphCall, [MarshalAs(UnmanagedType.LPStr)] string lpszDestAddress, uint dwCountryCode, IntPtr lpCallParams);
"@
$api = Add-Type -MemberDefinition $sig -Name 'TAPI32_lineMakeCallA' -Namespace Win32 -PassThru
# $api::lineMakeCallA(hLine, lphCall, lpszDestAddress, dwCountryCode, lpCallParams)#uselib "TAPI32.dll"
#func global lineMakeCallA "lineMakeCallA" sptr, sptr, sptr, sptr, sptr
; lineMakeCallA hLine, varptr(lphCall), lpszDestAddress, dwCountryCode, varptr(lpCallParams) ; 戻り値は stat
; hLine : DWORD -> "sptr"
; lphCall : DWORD* in/out -> "sptr"
; lpszDestAddress : LPCSTR -> "sptr"
; dwCountryCode : DWORD -> "sptr"
; lpCallParams : LINECALLPARAMS* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "TAPI32.dll" #cfunc global lineMakeCallA "lineMakeCallA" int, var, str, int, var ; res = lineMakeCallA(hLine, lphCall, lpszDestAddress, dwCountryCode, lpCallParams) ; hLine : DWORD -> "int" ; lphCall : DWORD* in/out -> "var" ; lpszDestAddress : LPCSTR -> "str" ; dwCountryCode : DWORD -> "int" ; lpCallParams : LINECALLPARAMS* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "TAPI32.dll" #cfunc global lineMakeCallA "lineMakeCallA" int, sptr, str, int, sptr ; res = lineMakeCallA(hLine, varptr(lphCall), lpszDestAddress, dwCountryCode, varptr(lpCallParams)) ; hLine : DWORD -> "int" ; lphCall : DWORD* in/out -> "sptr" ; lpszDestAddress : LPCSTR -> "str" ; dwCountryCode : DWORD -> "int" ; lpCallParams : LINECALLPARAMS* -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; INT lineMakeCallA(DWORD hLine, DWORD* lphCall, LPCSTR lpszDestAddress, DWORD dwCountryCode, LINECALLPARAMS* lpCallParams) #uselib "TAPI32.dll" #cfunc global lineMakeCallA "lineMakeCallA" int, var, str, int, var ; res = lineMakeCallA(hLine, lphCall, lpszDestAddress, dwCountryCode, lpCallParams) ; hLine : DWORD -> "int" ; lphCall : DWORD* in/out -> "var" ; lpszDestAddress : LPCSTR -> "str" ; dwCountryCode : DWORD -> "int" ; lpCallParams : LINECALLPARAMS* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; INT lineMakeCallA(DWORD hLine, DWORD* lphCall, LPCSTR lpszDestAddress, DWORD dwCountryCode, LINECALLPARAMS* lpCallParams) #uselib "TAPI32.dll" #cfunc global lineMakeCallA "lineMakeCallA" int, intptr, str, int, intptr ; res = lineMakeCallA(hLine, varptr(lphCall), lpszDestAddress, dwCountryCode, varptr(lpCallParams)) ; hLine : DWORD -> "int" ; lphCall : DWORD* in/out -> "intptr" ; lpszDestAddress : LPCSTR -> "str" ; dwCountryCode : DWORD -> "int" ; lpCallParams : LINECALLPARAMS* -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
tapi32 = windows.NewLazySystemDLL("TAPI32.dll")
proclineMakeCallA = tapi32.NewProc("lineMakeCallA")
)
// hLine (DWORD), lphCall (DWORD* in/out), lpszDestAddress (LPCSTR), dwCountryCode (DWORD), lpCallParams (LINECALLPARAMS*)
r1, _, err := proclineMakeCallA.Call(
uintptr(hLine),
uintptr(lphCall),
uintptr(unsafe.Pointer(windows.BytePtrFromString(lpszDestAddress))),
uintptr(dwCountryCode),
uintptr(lpCallParams),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction lineMakeCallA(
hLine: DWORD; // DWORD
lphCall: Pointer; // DWORD* in/out
lpszDestAddress: PAnsiChar; // LPCSTR
dwCountryCode: DWORD; // DWORD
lpCallParams: Pointer // LINECALLPARAMS*
): Integer; stdcall;
external 'TAPI32.dll' name 'lineMakeCallA';result := DllCall("TAPI32\lineMakeCallA"
, "UInt", hLine ; DWORD
, "Ptr", lphCall ; DWORD* in/out
, "AStr", lpszDestAddress ; LPCSTR
, "UInt", dwCountryCode ; DWORD
, "Ptr", lpCallParams ; LINECALLPARAMS*
, "Int") ; return: INT●lineMakeCallA(hLine, lphCall, lpszDestAddress, dwCountryCode, lpCallParams) = DLL("TAPI32.dll", "int lineMakeCallA(dword, void*, char*, dword, void*)")
# 呼び出し: lineMakeCallA(hLine, lphCall, lpszDestAddress, dwCountryCode, lpCallParams)
# hLine : DWORD -> "dword"
# lphCall : DWORD* in/out -> "void*"
# lpszDestAddress : LPCSTR -> "char*"
# dwCountryCode : DWORD -> "dword"
# lpCallParams : LINECALLPARAMS* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "tapi32" fn lineMakeCallA(
hLine: u32, // DWORD
lphCall: [*c]u32, // DWORD* in/out
lpszDestAddress: [*c]const u8, // LPCSTR
dwCountryCode: u32, // DWORD
lpCallParams: [*c]LINECALLPARAMS // LINECALLPARAMS*
) callconv(std.os.windows.WINAPI) i32;proc lineMakeCallA(
hLine: uint32, # DWORD
lphCall: ptr uint32, # DWORD* in/out
lpszDestAddress: cstring, # LPCSTR
dwCountryCode: uint32, # DWORD
lpCallParams: ptr LINECALLPARAMS # LINECALLPARAMS*
): int32 {.importc: "lineMakeCallA", stdcall, dynlib: "TAPI32.dll".}pragma(lib, "tapi32");
extern(Windows)
int lineMakeCallA(
uint hLine, // DWORD
uint* lphCall, // DWORD* in/out
const(char)* lpszDestAddress, // LPCSTR
uint dwCountryCode, // DWORD
LINECALLPARAMS* lpCallParams // LINECALLPARAMS*
);ccall((:lineMakeCallA, "TAPI32.dll"), stdcall, Int32,
(UInt32, Ptr{UInt32}, Cstring, UInt32, Ptr{LINECALLPARAMS}),
hLine, lphCall, lpszDestAddress, dwCountryCode, lpCallParams)
# hLine : DWORD -> UInt32
# lphCall : DWORD* in/out -> Ptr{UInt32}
# lpszDestAddress : LPCSTR -> Cstring
# dwCountryCode : DWORD -> UInt32
# lpCallParams : LINECALLPARAMS* -> Ptr{LINECALLPARAMS}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t lineMakeCallA(
uint32_t hLine,
uint32_t* lphCall,
const char* lpszDestAddress,
uint32_t dwCountryCode,
void* lpCallParams);
]]
local tapi32 = ffi.load("tapi32")
-- tapi32.lineMakeCallA(hLine, lphCall, lpszDestAddress, dwCountryCode, lpCallParams)
-- hLine : DWORD
-- lphCall : DWORD* in/out
-- lpszDestAddress : LPCSTR
-- dwCountryCode : DWORD
-- lpCallParams : LINECALLPARAMS*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('TAPI32.dll');
const lineMakeCallA = lib.func('__stdcall', 'lineMakeCallA', 'int32_t', ['uint32_t', 'uint32_t *', 'str', 'uint32_t', 'void *']);
// lineMakeCallA(hLine, lphCall, lpszDestAddress, dwCountryCode, lpCallParams)
// hLine : DWORD -> 'uint32_t'
// lphCall : DWORD* in/out -> 'uint32_t *'
// lpszDestAddress : LPCSTR -> 'str'
// dwCountryCode : DWORD -> 'uint32_t'
// lpCallParams : LINECALLPARAMS* -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("TAPI32.dll", {
lineMakeCallA: { parameters: ["u32", "pointer", "buffer", "u32", "pointer"], result: "i32" },
});
// lib.symbols.lineMakeCallA(hLine, lphCall, lpszDestAddress, dwCountryCode, lpCallParams)
// hLine : DWORD -> "u32"
// lphCall : DWORD* in/out -> "pointer"
// lpszDestAddress : LPCSTR -> "buffer"
// dwCountryCode : DWORD -> "u32"
// lpCallParams : LINECALLPARAMS* -> "pointer"
// 文字列は "buffer"。ANSI(-A) は new TextEncoder() で UTF-8/ANSI バイト列(末尾に \x00)を渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t lineMakeCallA(
uint32_t hLine,
uint32_t* lphCall,
const char* lpszDestAddress,
uint32_t dwCountryCode,
void* lpCallParams);
C, "TAPI32.dll");
// $ffi->lineMakeCallA(hLine, lphCall, lpszDestAddress, dwCountryCode, lpCallParams);
// hLine : DWORD
// lphCall : DWORD* in/out
// lpszDestAddress : LPCSTR
// dwCountryCode : DWORD
// lpCallParams : LINECALLPARAMS*
// 構造体/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 lineMakeCallA(
int hLine, // DWORD
IntByReference lphCall, // DWORD* in/out
String lpszDestAddress, // LPCSTR
int dwCountryCode, // DWORD
Pointer lpCallParams // LINECALLPARAMS*
);
}@[Link("tapi32")]
lib LibTAPI32
fun lineMakeCallA = lineMakeCallA(
hLine : UInt32, # DWORD
lphCall : UInt32*, # DWORD* in/out
lpszDestAddress : UInt8*, # LPCSTR
dwCountryCode : UInt32, # DWORD
lpCallParams : LINECALLPARAMS* # LINECALLPARAMS*
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef lineMakeCallANative = Int32 Function(Uint32, Pointer<Uint32>, Pointer<Utf8>, Uint32, Pointer<Void>);
typedef lineMakeCallADart = int Function(int, Pointer<Uint32>, Pointer<Utf8>, int, Pointer<Void>);
final lineMakeCallA = DynamicLibrary.open('TAPI32.dll')
.lookupFunction<lineMakeCallANative, lineMakeCallADart>('lineMakeCallA');
// hLine : DWORD -> Uint32
// lphCall : DWORD* in/out -> Pointer<Uint32>
// lpszDestAddress : LPCSTR -> Pointer<Utf8>
// dwCountryCode : DWORD -> Uint32
// lpCallParams : LINECALLPARAMS* -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function lineMakeCallA(
hLine: DWORD; // DWORD
lphCall: Pointer; // DWORD* in/out
lpszDestAddress: PAnsiChar; // LPCSTR
dwCountryCode: DWORD; // DWORD
lpCallParams: Pointer // LINECALLPARAMS*
): Integer; stdcall;
external 'TAPI32.dll' name 'lineMakeCallA';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "lineMakeCallA"
c_lineMakeCallA :: Word32 -> Ptr Word32 -> CString -> Word32 -> Ptr () -> IO Int32
-- hLine : DWORD -> Word32
-- lphCall : DWORD* in/out -> Ptr Word32
-- lpszDestAddress : LPCSTR -> CString
-- dwCountryCode : DWORD -> Word32
-- lpCallParams : LINECALLPARAMS* -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let linemakecalla =
foreign "lineMakeCallA"
(uint32_t @-> (ptr uint32_t) @-> string @-> uint32_t @-> (ptr void) @-> returning int32_t)
(* hLine : DWORD -> uint32_t *)
(* lphCall : DWORD* in/out -> (ptr uint32_t) *)
(* lpszDestAddress : LPCSTR -> string *)
(* dwCountryCode : DWORD -> uint32_t *)
(* lpCallParams : LINECALLPARAMS* -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library tapi32 (t "TAPI32.dll"))
(cffi:use-foreign-library tapi32)
(cffi:defcfun ("lineMakeCallA" line-make-call-a :convention :stdcall) :int32
(h-line :uint32) ; DWORD
(lph-call :pointer) ; DWORD* in/out
(lpsz-dest-address :string) ; LPCSTR
(dw-country-code :uint32) ; DWORD
(lp-call-params :pointer)) ; LINECALLPARAMS*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $lineMakeCallA = Win32::API::More->new('TAPI32',
'int lineMakeCallA(DWORD hLine, LPVOID lphCall, LPCSTR lpszDestAddress, DWORD dwCountryCode, LPVOID lpCallParams)');
# my $ret = $lineMakeCallA->Call($hLine, $lphCall, $lpszDestAddress, $dwCountryCode, $lpCallParams);
# hLine : DWORD -> DWORD
# lphCall : DWORD* in/out -> LPVOID
# lpszDestAddress : LPCSTR -> LPCSTR
# dwCountryCode : DWORD -> DWORD
# lpCallParams : LINECALLPARAMS* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
文字セット違い
- f lineMakeCallW (Unicode版) — 指定アドレスへ発信して新しい通話を開始する(Unicode版)。
使用する型