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

lineDialW

関数
接続済みの通話で指定アドレスへダイヤルする(Unicode版)。
DLLTAPI32.dll文字セットUnicode (-W)呼出規約winapi

シグネチャ

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

INT lineDialW(
    DWORD hCall,
    LPCWSTR lpszDestAddress,
    DWORD dwCountryCode
);

パラメーター

名前方向説明
hCallDWORDinダイヤルする対象の通話ハンドル。
lpszDestAddressLPCWSTRinダイヤルする宛先アドレス文字列(Unicode)へのポインタ。
dwCountryCodeDWORDin宛先の国コードを指定する。0で既定値を使用する。

戻り値の型: INT

各言語での呼び出し定義

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

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

lineDialW = ctypes.windll.tapi32.lineDialW
lineDialW.restype = ctypes.c_int
lineDialW.argtypes = [
    wintypes.DWORD,  # hCall : DWORD
    wintypes.LPCWSTR,  # lpszDestAddress : LPCWSTR
    wintypes.DWORD,  # dwCountryCode : DWORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('TAPI32.dll')
lineDialW = Fiddle::Function.new(
  lib['lineDialW'],
  [
    -Fiddle::TYPE_INT,  # hCall : DWORD
    Fiddle::TYPE_VOIDP,  # lpszDestAddress : LPCWSTR
    -Fiddle::TYPE_INT,  # dwCountryCode : DWORD
  ],
  Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "tapi32")]
extern "system" {
    fn lineDialW(
        hCall: u32,  // DWORD
        lpszDestAddress: *const u16,  // LPCWSTR
        dwCountryCode: u32  // DWORD
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("TAPI32.dll", CharSet = CharSet.Unicode)]
public static extern int lineDialW(uint hCall, [MarshalAs(UnmanagedType.LPWStr)] string lpszDestAddress, uint dwCountryCode);
"@
$api = Add-Type -MemberDefinition $sig -Name 'TAPI32_lineDialW' -Namespace Win32 -PassThru
# $api::lineDialW(hCall, lpszDestAddress, dwCountryCode)
#uselib "TAPI32.dll"
#func global lineDialW "lineDialW" wptr, wptr, wptr
; lineDialW hCall, lpszDestAddress, dwCountryCode   ; 戻り値は stat
; hCall : DWORD -> "wptr"
; lpszDestAddress : LPCWSTR -> "wptr"
; dwCountryCode : DWORD -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "TAPI32.dll"
#cfunc global lineDialW "lineDialW" int, wstr, int
; res = lineDialW(hCall, lpszDestAddress, dwCountryCode)
; hCall : DWORD -> "int"
; lpszDestAddress : LPCWSTR -> "wstr"
; dwCountryCode : DWORD -> "int"
; INT lineDialW(DWORD hCall, LPCWSTR lpszDestAddress, DWORD dwCountryCode)
#uselib "TAPI32.dll"
#cfunc global lineDialW "lineDialW" int, wstr, int
; res = lineDialW(hCall, lpszDestAddress, dwCountryCode)
; hCall : DWORD -> "int"
; lpszDestAddress : LPCWSTR -> "wstr"
; dwCountryCode : DWORD -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	tapi32 = windows.NewLazySystemDLL("TAPI32.dll")
	proclineDialW = tapi32.NewProc("lineDialW")
)

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

extern "tapi32" fn lineDialW(
    hCall: u32, // DWORD
    lpszDestAddress: [*c]const u16, // LPCWSTR
    dwCountryCode: u32 // DWORD
) callconv(std.os.windows.WINAPI) i32;
// Unicode(-W): UTF-16LE のヌル終端バッファ([*c]const u16)を渡す。
proc lineDialW(
    hCall: uint32,  # DWORD
    lpszDestAddress: WideCString,  # LPCWSTR
    dwCountryCode: uint32  # DWORD
): int32 {.importc: "lineDialW", stdcall, dynlib: "TAPI32.dll".}
# Unicode(-W): WideCString は newWideCString("...") で生成。
pragma(lib, "tapi32");
extern(Windows)
int lineDialW(
    uint hCall,   // DWORD
    const(wchar)* lpszDestAddress,   // LPCWSTR
    uint dwCountryCode   // DWORD
);
ccall((:lineDialW, "TAPI32.dll"), stdcall, Int32,
      (UInt32, Cwstring, UInt32),
      hCall, lpszDestAddress, dwCountryCode)
# hCall : DWORD -> UInt32
# lpszDestAddress : LPCWSTR -> Cwstring
# dwCountryCode : DWORD -> UInt32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
# Unicode(-W): Cwstring には transcode(UInt16, "...") 等で UTF-16 を渡す。
local ffi = require("ffi")
ffi.cdef[[
int32_t lineDialW(
    uint32_t hCall,
    const uint16_t* lpszDestAddress,
    uint32_t dwCountryCode);
]]
local tapi32 = ffi.load("tapi32")
-- tapi32.lineDialW(hCall, lpszDestAddress, dwCountryCode)
-- hCall : DWORD
-- lpszDestAddress : LPCWSTR
-- dwCountryCode : DWORD
-- 構造体/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 lineDialW = lib.func('__stdcall', 'lineDialW', 'int32_t', ['uint32_t', 'str16', 'uint32_t']);
// lineDialW(hCall, lpszDestAddress, dwCountryCode)
// hCall : DWORD -> 'uint32_t'
// lpszDestAddress : LPCWSTR -> 'str16'
// dwCountryCode : DWORD -> 'uint32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("TAPI32.dll", {
  lineDialW: { parameters: ["u32", "buffer", "u32"], result: "i32" },
});
// lib.symbols.lineDialW(hCall, lpszDestAddress, dwCountryCode)
// hCall : DWORD -> "u32"
// lpszDestAddress : LPCWSTR -> "buffer"
// dwCountryCode : DWORD -> "u32"
// 文字列は "buffer"。Unicode(-W) は new TextEncoder() ではなく UTF-16LE のバイト列(末尾に \x00\x00)を Uint8Array で渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t lineDialW(
    uint32_t hCall,
    const uint16_t* lpszDestAddress,
    uint32_t dwCountryCode);
C, "TAPI32.dll");
// $ffi->lineDialW(hCall, lpszDestAddress, dwCountryCode);
// hCall : DWORD
// lpszDestAddress : LPCWSTR
// dwCountryCode : DWORD
// 構造体/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 lineDialW(
        int hCall,   // DWORD
        WString lpszDestAddress,   // LPCWSTR
        int dwCountryCode   // DWORD
    );
}
// Unicode(-W): WString(入力)/char[](出力)で UTF-16 をマーシャリング。
@[Link("tapi32")]
lib LibTAPI32
  fun lineDialW = lineDialW(
    hCall : UInt32,   # DWORD
    lpszDestAddress : UInt16*,   # LPCWSTR
    dwCountryCode : UInt32   # DWORD
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef lineDialWNative = Int32 Function(Uint32, Pointer<Utf16>, Uint32);
typedef lineDialWDart = int Function(int, Pointer<Utf16>, int);
final lineDialW = DynamicLibrary.open('TAPI32.dll')
    .lookupFunction<lineDialWNative, lineDialWDart>('lineDialW');
// hCall : DWORD -> Uint32
// lpszDestAddress : LPCWSTR -> Pointer<Utf16>
// dwCountryCode : DWORD -> Uint32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function lineDialW(
  hCall: DWORD;   // DWORD
  lpszDestAddress: PWideChar;   // LPCWSTR
  dwCountryCode: DWORD   // DWORD
): Integer; stdcall;
  external 'TAPI32.dll' name 'lineDialW';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "lineDialW"
  c_lineDialW :: Word32 -> CWString -> Word32 -> IO Int32
-- hCall : DWORD -> Word32
-- lpszDestAddress : LPCWSTR -> CWString
-- dwCountryCode : DWORD -> Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let linedialw =
  foreign "lineDialW"
    (uint32_t @-> (ptr uint16_t) @-> uint32_t @-> returning int32_t)
(* hCall : DWORD -> uint32_t *)
(* lpszDestAddress : LPCWSTR -> (ptr uint16_t) *)
(* dwCountryCode : DWORD -> uint32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library tapi32 (t "TAPI32.dll"))
(cffi:use-foreign-library tapi32)

(cffi:defcfun ("lineDialW" line-dial-w :convention :stdcall) :int32
  (h-call :uint32)   ; DWORD
  (lpsz-dest-address (:string :encoding :utf-16le))   ; LPCWSTR
  (dw-country-code :uint32))   ; DWORD
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $lineDialW = Win32::API::More->new('TAPI32',
    'int lineDialW(DWORD hCall, LPCWSTR lpszDestAddress, DWORD dwCountryCode)');
# my $ret = $lineDialW->Call($hCall, $lpszDestAddress, $dwCountryCode);
# hCall : DWORD -> DWORD
# lpszDestAddress : LPCWSTR -> LPCWSTR
# dwCountryCode : DWORD -> DWORD
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# Unicode(-W): LPCWSTR/LPWSTR は Win32::API が UTF-16 変換を行う。

関連項目

文字セット違い