Win32 API 日本語リファレンス
ホームDevices.Tapi › lineMakeCallW

lineMakeCallW

関数
指定アドレスへ発信して新しい通話を開始する(Unicode版)。
DLLTAPI32.dll文字セットUnicode (-W)呼出規約winapi

シグネチャ

// TAPI32.dll  (Unicode / -W)
#include <windows.h>

INT lineMakeCallW(
    DWORD hLine,
    DWORD* lphCall,
    LPCWSTR lpszDestAddress,
    DWORD dwCountryCode,
    const LINECALLPARAMS* lpCallParams
);

パラメーター

名前方向説明
hLineDWORDin発信に使用する開いた回線のハンドル。
lphCallDWORD*inout新規発信通話のハンドルを受け取るDWORDへのポインタ。
lpszDestAddressLPCWSTRin発信先アドレス(電話番号等)を示すUnicode文字列。NULL可で番号未指定の発信となる。
dwCountryCodeDWORDin発信先の国番号。トーン選択等に用い、0で既定値を使用する。
lpCallParamsLINECALLPARAMS*in発信時の通話パラメータを指定するLINECALLPARAMS構造体へのポインタ。NULL可で既定値となる。

戻り値の型: INT

各言語での呼び出し定義

// TAPI32.dll  (Unicode / -W)
#include <windows.h>

INT lineMakeCallW(
    DWORD hLine,
    DWORD* lphCall,
    LPCWSTR lpszDestAddress,
    DWORD dwCountryCode,
    const LINECALLPARAMS* lpCallParams
);
[DllImport("TAPI32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern int lineMakeCallW(
    uint hLine,   // DWORD
    ref uint lphCall,   // DWORD* in/out
    [MarshalAs(UnmanagedType.LPWStr)] string lpszDestAddress,   // LPCWSTR
    uint dwCountryCode,   // DWORD
    IntPtr lpCallParams   // LINECALLPARAMS*
);
<DllImport("TAPI32.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function lineMakeCallW(
    hLine As UInteger,   ' DWORD
    ByRef lphCall As UInteger,   ' DWORD* in/out
    <MarshalAs(UnmanagedType.LPWStr)> lpszDestAddress As String,   ' LPCWSTR
    dwCountryCode As UInteger,   ' DWORD
    lpCallParams As IntPtr   ' LINECALLPARAMS*
) As Integer
End Function
' hLine : DWORD
' lphCall : DWORD* in/out
' lpszDestAddress : LPCWSTR
' dwCountryCode : DWORD
' lpCallParams : LINECALLPARAMS*
Declare PtrSafe Function lineMakeCallW Lib "tapi32" ( _
    ByVal hLine As Long, _
    ByRef lphCall As Long, _
    ByVal lpszDestAddress As LongPtr, _
    ByVal dwCountryCode As Long, _
    ByVal lpCallParams 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

lineMakeCallW = ctypes.windll.tapi32.lineMakeCallW
lineMakeCallW.restype = ctypes.c_int
lineMakeCallW.argtypes = [
    wintypes.DWORD,  # hLine : DWORD
    ctypes.POINTER(wintypes.DWORD),  # lphCall : DWORD* in/out
    wintypes.LPCWSTR,  # lpszDestAddress : LPCWSTR
    wintypes.DWORD,  # dwCountryCode : DWORD
    ctypes.c_void_p,  # lpCallParams : LINECALLPARAMS*
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('TAPI32.dll')
lineMakeCallW = Fiddle::Function.new(
  lib['lineMakeCallW'],
  [
    -Fiddle::TYPE_INT,  # hLine : DWORD
    Fiddle::TYPE_VOIDP,  # lphCall : DWORD* in/out
    Fiddle::TYPE_VOIDP,  # lpszDestAddress : LPCWSTR
    -Fiddle::TYPE_INT,  # dwCountryCode : DWORD
    Fiddle::TYPE_VOIDP,  # lpCallParams : LINECALLPARAMS*
  ],
  Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "tapi32")]
extern "system" {
    fn lineMakeCallW(
        hLine: u32,  // DWORD
        lphCall: *mut u32,  // DWORD* in/out
        lpszDestAddress: *const u16,  // LPCWSTR
        dwCountryCode: u32,  // DWORD
        lpCallParams: *const LINECALLPARAMS  // LINECALLPARAMS*
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("TAPI32.dll", CharSet = CharSet.Unicode)]
public static extern int lineMakeCallW(uint hLine, ref uint lphCall, [MarshalAs(UnmanagedType.LPWStr)] string lpszDestAddress, uint dwCountryCode, IntPtr lpCallParams);
"@
$api = Add-Type -MemberDefinition $sig -Name 'TAPI32_lineMakeCallW' -Namespace Win32 -PassThru
# $api::lineMakeCallW(hLine, lphCall, lpszDestAddress, dwCountryCode, lpCallParams)
#uselib "TAPI32.dll"
#func global lineMakeCallW "lineMakeCallW" wptr, wptr, wptr, wptr, wptr
; lineMakeCallW hLine, varptr(lphCall), lpszDestAddress, dwCountryCode, varptr(lpCallParams)   ; 戻り値は stat
; hLine : DWORD -> "wptr"
; lphCall : DWORD* in/out -> "wptr"
; lpszDestAddress : LPCWSTR -> "wptr"
; dwCountryCode : DWORD -> "wptr"
; lpCallParams : LINECALLPARAMS* -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "TAPI32.dll"
#cfunc global lineMakeCallW "lineMakeCallW" int, var, wstr, int, var
; res = lineMakeCallW(hLine, lphCall, lpszDestAddress, dwCountryCode, lpCallParams)
; hLine : DWORD -> "int"
; lphCall : DWORD* in/out -> "var"
; lpszDestAddress : LPCWSTR -> "wstr"
; dwCountryCode : DWORD -> "int"
; lpCallParams : LINECALLPARAMS* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; INT lineMakeCallW(DWORD hLine, DWORD* lphCall, LPCWSTR lpszDestAddress, DWORD dwCountryCode, LINECALLPARAMS* lpCallParams)
#uselib "TAPI32.dll"
#cfunc global lineMakeCallW "lineMakeCallW" int, var, wstr, int, var
; res = lineMakeCallW(hLine, lphCall, lpszDestAddress, dwCountryCode, lpCallParams)
; hLine : DWORD -> "int"
; lphCall : DWORD* in/out -> "var"
; lpszDestAddress : LPCWSTR -> "wstr"
; dwCountryCode : DWORD -> "int"
; lpCallParams : LINECALLPARAMS* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	tapi32 = windows.NewLazySystemDLL("TAPI32.dll")
	proclineMakeCallW = tapi32.NewProc("lineMakeCallW")
)

// hLine (DWORD), lphCall (DWORD* in/out), lpszDestAddress (LPCWSTR), dwCountryCode (DWORD), lpCallParams (LINECALLPARAMS*)
r1, _, err := proclineMakeCallW.Call(
	uintptr(hLine),
	uintptr(lphCall),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpszDestAddress))),
	uintptr(dwCountryCode),
	uintptr(lpCallParams),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // INT
function lineMakeCallW(
  hLine: DWORD;   // DWORD
  lphCall: Pointer;   // DWORD* in/out
  lpszDestAddress: PWideChar;   // LPCWSTR
  dwCountryCode: DWORD;   // DWORD
  lpCallParams: Pointer   // LINECALLPARAMS*
): Integer; stdcall;
  external 'TAPI32.dll' name 'lineMakeCallW';
result := DllCall("TAPI32\lineMakeCallW"
    , "UInt", hLine   ; DWORD
    , "Ptr", lphCall   ; DWORD* in/out
    , "WStr", lpszDestAddress   ; LPCWSTR
    , "UInt", dwCountryCode   ; DWORD
    , "Ptr", lpCallParams   ; LINECALLPARAMS*
    , "Int")   ; return: INT
●lineMakeCallW(hLine, lphCall, lpszDestAddress, dwCountryCode, lpCallParams) = DLL("TAPI32.dll", "int lineMakeCallW(dword, void*, char*, dword, void*)")
# 呼び出し: lineMakeCallW(hLine, lphCall, lpszDestAddress, dwCountryCode, lpCallParams)
# hLine : DWORD -> "dword"
# lphCall : DWORD* in/out -> "void*"
# lpszDestAddress : LPCWSTR -> "char*"
# dwCountryCode : DWORD -> "dword"
# lpCallParams : LINECALLPARAMS* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。
const std = @import("std");

extern "tapi32" fn lineMakeCallW(
    hLine: u32, // DWORD
    lphCall: [*c]u32, // DWORD* in/out
    lpszDestAddress: [*c]const u16, // LPCWSTR
    dwCountryCode: u32, // DWORD
    lpCallParams: [*c]LINECALLPARAMS // LINECALLPARAMS*
) callconv(std.os.windows.WINAPI) i32;
// Unicode(-W): UTF-16LE のヌル終端バッファ([*c]const u16)を渡す。
proc lineMakeCallW(
    hLine: uint32,  # DWORD
    lphCall: ptr uint32,  # DWORD* in/out
    lpszDestAddress: WideCString,  # LPCWSTR
    dwCountryCode: uint32,  # DWORD
    lpCallParams: ptr LINECALLPARAMS  # LINECALLPARAMS*
): int32 {.importc: "lineMakeCallW", stdcall, dynlib: "TAPI32.dll".}
# Unicode(-W): WideCString は newWideCString("...") で生成。
pragma(lib, "tapi32");
extern(Windows)
int lineMakeCallW(
    uint hLine,   // DWORD
    uint* lphCall,   // DWORD* in/out
    const(wchar)* lpszDestAddress,   // LPCWSTR
    uint dwCountryCode,   // DWORD
    LINECALLPARAMS* lpCallParams   // LINECALLPARAMS*
);
ccall((:lineMakeCallW, "TAPI32.dll"), stdcall, Int32,
      (UInt32, Ptr{UInt32}, Cwstring, UInt32, Ptr{LINECALLPARAMS}),
      hLine, lphCall, lpszDestAddress, dwCountryCode, lpCallParams)
# hLine : DWORD -> UInt32
# lphCall : DWORD* in/out -> Ptr{UInt32}
# lpszDestAddress : LPCWSTR -> Cwstring
# dwCountryCode : DWORD -> UInt32
# lpCallParams : LINECALLPARAMS* -> Ptr{LINECALLPARAMS}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
# Unicode(-W): Cwstring には transcode(UInt16, "...") 等で UTF-16 を渡す。
local ffi = require("ffi")
ffi.cdef[[
int32_t lineMakeCallW(
    uint32_t hLine,
    uint32_t* lphCall,
    const uint16_t* lpszDestAddress,
    uint32_t dwCountryCode,
    void* lpCallParams);
]]
local tapi32 = ffi.load("tapi32")
-- tapi32.lineMakeCallW(hLine, lphCall, lpszDestAddress, dwCountryCode, lpCallParams)
-- hLine : DWORD
-- lphCall : DWORD* in/out
-- lpszDestAddress : LPCWSTR
-- dwCountryCode : DWORD
-- lpCallParams : LINECALLPARAMS*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
-- Unicode(-W): uint16_t* には UTF-16LE のバッファ(ffi.new("uint16_t[?]", ...))を渡す。
const koffi = require('koffi');
const lib = koffi.load('TAPI32.dll');
const lineMakeCallW = lib.func('__stdcall', 'lineMakeCallW', 'int32_t', ['uint32_t', 'uint32_t *', 'str16', 'uint32_t', 'void *']);
// lineMakeCallW(hLine, lphCall, lpszDestAddress, dwCountryCode, lpCallParams)
// hLine : DWORD -> 'uint32_t'
// lphCall : DWORD* in/out -> 'uint32_t *'
// lpszDestAddress : LPCWSTR -> 'str16'
// dwCountryCode : DWORD -> 'uint32_t'
// lpCallParams : LINECALLPARAMS* -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("TAPI32.dll", {
  lineMakeCallW: { parameters: ["u32", "pointer", "buffer", "u32", "pointer"], result: "i32" },
});
// lib.symbols.lineMakeCallW(hLine, lphCall, lpszDestAddress, dwCountryCode, lpCallParams)
// hLine : DWORD -> "u32"
// lphCall : DWORD* in/out -> "pointer"
// lpszDestAddress : LPCWSTR -> "buffer"
// dwCountryCode : DWORD -> "u32"
// lpCallParams : LINECALLPARAMS* -> "pointer"
// 文字列は "buffer"。Unicode(-W) は new TextEncoder() ではなく UTF-16LE のバイト列(末尾に \x00\x00)を Uint8Array で渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t lineMakeCallW(
    uint32_t hLine,
    uint32_t* lphCall,
    const uint16_t* lpszDestAddress,
    uint32_t dwCountryCode,
    void* lpCallParams);
C, "TAPI32.dll");
// $ffi->lineMakeCallW(hLine, lphCall, lpszDestAddress, dwCountryCode, lpCallParams);
// hLine : DWORD
// lphCall : DWORD* in/out
// lpszDestAddress : LPCWSTR
// 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.UNICODE_OPTIONS);
    int lineMakeCallW(
        int hLine,   // DWORD
        IntByReference lphCall,   // DWORD* in/out
        WString lpszDestAddress,   // LPCWSTR
        int dwCountryCode,   // DWORD
        Pointer lpCallParams   // LINECALLPARAMS*
    );
}
// Unicode(-W): WString(入力)/char[](出力)で UTF-16 をマーシャリング。
@[Link("tapi32")]
lib LibTAPI32
  fun lineMakeCallW = lineMakeCallW(
    hLine : UInt32,   # DWORD
    lphCall : UInt32*,   # DWORD* in/out
    lpszDestAddress : UInt16*,   # LPCWSTR
    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 lineMakeCallWNative = Int32 Function(Uint32, Pointer<Uint32>, Pointer<Utf16>, Uint32, Pointer<Void>);
typedef lineMakeCallWDart = int Function(int, Pointer<Uint32>, Pointer<Utf16>, int, Pointer<Void>);
final lineMakeCallW = DynamicLibrary.open('TAPI32.dll')
    .lookupFunction<lineMakeCallWNative, lineMakeCallWDart>('lineMakeCallW');
// hLine : DWORD -> Uint32
// lphCall : DWORD* in/out -> Pointer<Uint32>
// lpszDestAddress : LPCWSTR -> Pointer<Utf16>
// dwCountryCode : DWORD -> Uint32
// lpCallParams : LINECALLPARAMS* -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function lineMakeCallW(
  hLine: DWORD;   // DWORD
  lphCall: Pointer;   // DWORD* in/out
  lpszDestAddress: PWideChar;   // LPCWSTR
  dwCountryCode: DWORD;   // DWORD
  lpCallParams: Pointer   // LINECALLPARAMS*
): Integer; stdcall;
  external 'TAPI32.dll' name 'lineMakeCallW';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "lineMakeCallW"
  c_lineMakeCallW :: Word32 -> Ptr Word32 -> CWString -> Word32 -> Ptr () -> IO Int32
-- hLine : DWORD -> Word32
-- lphCall : DWORD* in/out -> Ptr Word32
-- lpszDestAddress : LPCWSTR -> CWString
-- dwCountryCode : DWORD -> Word32
-- lpCallParams : LINECALLPARAMS* -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let linemakecallw =
  foreign "lineMakeCallW"
    (uint32_t @-> (ptr uint32_t) @-> (ptr uint16_t) @-> uint32_t @-> (ptr void) @-> returning int32_t)
(* hLine : DWORD -> uint32_t *)
(* lphCall : DWORD* in/out -> (ptr uint32_t) *)
(* lpszDestAddress : LPCWSTR -> (ptr uint16_t) *)
(* 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 ("lineMakeCallW" line-make-call-w :convention :stdcall) :int32
  (h-line :uint32)   ; DWORD
  (lph-call :pointer)   ; DWORD* in/out
  (lpsz-dest-address (:string :encoding :utf-16le))   ; LPCWSTR
  (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 $lineMakeCallW = Win32::API::More->new('TAPI32',
    'int lineMakeCallW(DWORD hLine, LPVOID lphCall, LPCWSTR lpszDestAddress, DWORD dwCountryCode, LPVOID lpCallParams)');
# my $ret = $lineMakeCallW->Call($hLine, $lphCall, $lpszDestAddress, $dwCountryCode, $lpCallParams);
# hLine : DWORD -> DWORD
# lphCall : DWORD* in/out -> LPVOID
# lpszDestAddress : LPCWSTR -> LPCWSTR
# dwCountryCode : DWORD -> DWORD
# lpCallParams : LINECALLPARAMS* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# Unicode(-W): LPCWSTR/LPWSTR は Win32::API が UTF-16 変換を行う。

関連項目

文字セット違い
使用する型